Question What does "Poking at CPU registers" mean ?

shaharhada

Reputable
Jul 27, 2020
321
8
4,685
I think there's been some Pascal operating systems, but I don't think I've seen BASIC of any flavor... You might look around on osdev.org's forums and see if anyone has been playing with those ideas.

The well trodden path is C with a bit of assembly to do the important things that C can't really do: getting the processor into the right mode, setting up stacks, switching stacks when switching tasks, some stuff around interrupts and user/kernel boundaries, poking at cpu registers, etc. You can do the same assembly work to support Pascal or BASIC instead, but there may not be examples to follow.
What is poking in the phrase "poking at cpu registers"?
From the link https://hardforum.com/threads/programming-an-os.2022350/#post-1045469087
that was said by philb2 responder?
 
Peeking and poking can be done by many programming languages.

Peek can be disabled in Windows. Reference:

https://www.microcenter.com/tech_ce...-peek-in-windows-10?lat=39.0078&long=-76.6854

And you can likewise block pokes into the Registry.

https://www.groovypost.com/howto/disable-access-windows-registry/

However, generic blocking of such peeking and poking actions could be counter-productive towards writing and executing some code.

If a coder is developing an app that does not require any peeking or poking into CPU registers then those "tools" might be disabled in some other manner. Maybe simply left out of the development tool kit or disabled in some manner by a higher admin level. Depends on the SDK perhaps.

If the coders need to be poking CPU registers then they should be working on a system with an OS that allow the coders to do so.

And a system or Virtual Machine that can easily be recovered if an error occurs.... :)
 
Peeking and poking can be done by many programming languages.

Peek can be disabled in Windows. Reference:

https://www.microcenter.com/tech_ce...-peek-in-windows-10?lat=39.0078&long=-76.6854

And you can likewise block pokes into the Registry.

https://www.groovypost.com/howto/disable-access-windows-registry/

However, generic blocking of such peeking and poking actions could be counter-productive towards writing and executing some code.

If a coder is developing an app that does not require any peeking or poking into CPU registers then those "tools" might be disabled in some other manner. Maybe simply left out of the development tool kit or disabled in some manner by a higher admin level. Depends on the SDK perhaps.

If the coders need to be poking CPU registers then they should be working on a system with an OS that allow the coders to do so.

And a system or Virtual Machine that can easily be recovered if an error occurs.... :)
However, generic blocking of such peeking and poking actions could be counter-productive towards writing and executing some code.

What is the meaning of phrase "counter-productive " (actions)?
 
Raking a yard to clean up fall leaves is productive.

Raking a yard to clean up fall leaves when there are strong winds is counter-productive.

The raking will just stir up the settled leaves and then those now unsettled leaves will then blow all around even more.
 
I think there's been some Pascal operating systems, but I don't think I've seen BASIC of any flavor... You might look around on osdev.org's forums and see if anyone has been playing with those ideas.

The well trodden path is C with a bit of assembly to do the important things that C can't really do: getting the processor into the right mode, setting up stacks, switching stacks when switching tasks, some stuff around interrupts and user/kernel boundaries, poking at cpu registers, etc. You can do the same assembly work to support Pascal or BASIC instead, but there may not be examples to follow.
What is poking in the phrase "poking at cpu registers"?
From the link https://hardforum.com/threads/programming-an-os.2022350/#post-1045469087
that was said by philb2 responder?
"Poking" typically means writing a value to the register. But generally speaking, it means interacting with it in some way.

Question: When the OS doesn't allow poking at CPU registers?
Which cases the OS do not allow this?
For most of the general purpose registers, for example in x86 processors these would be like the EAX/EBX/ECX/EDX registers, the OS can't really block the usage of them as these are assumed to always be available in a given application. In fact, to this day, applications are run in such away that the application believes it owns the entire computer, even though it really doesn't. This makes it easier to allow an application to run on any given system configuration. Even two machines whose only difference is the amount of RAM can drastically change what your assumptions are.

The only registers I can imaging the OS not allowing applications to poke at are those that require elevated privileges and the application hasn't requested the OS to transfer the CPU to a higher privileged mode. That is, say the CPU has some registers for storing a secret key or password. You don't want applications being able to access this unless the application asks the OS first.

However, generic blocking of such peeking and poking actions could be counter-productive towards writing and executing some code.

What is the meaning of phrase "counter-productive " (actions)?
As mentioned, there's a lot of general purpose registers that applications are expected to be available. Blocking their usage would mean fewer register to work with, which can degrade performance.