Probably seems like a stupid question to most of you, but something I really need to know. I guess it must be, due to the multitasking nature of the OS.
Posted on 2001-12-28 17:29:18 by ClownHat
No, it runs in protected mode. Even win32 console apps don't run in V86 mode; otherwise, how could you use 80x86 instructions, registers, etc.
Posted on 2001-12-28 18:00:19 by eet_1024
So, when one Windows program modifies a register, how do the rest keep running unaffected? Or is that what protected mode entails?
Sorry, I'm new to this very low level stuff.
Posted on 2001-12-28 18:04:27 by ClownHat
I believe (not 100% sure about that, but experts will correct me...)
that the only cases a Win32 prog is running into a VMM is when it is debugged or emulated (ie anti-virus software)
Posted on 2001-12-28 18:52:37 by Axial

So, when one Windows program modifies a register, how do the rest keep running unaffected? Or is that what protected mode entails?
Sorry, I'm new to this very low level stuff.


Ive wondered to about this sometimes. If i was gonna make an operating system, the only thing i came up with to get around this problem is to keep the stack saved and the registers saved for every program. And when its that programs time to do some code, it restores everything from the saved variables. Then when its turn is over, it saves everything.

But i really have no idea how they actually do it.
Posted on 2001-12-28 20:38:03 by ChimpFace9000
Phew, I'm not alone in being confused about that then.

I thought the same thing as you did, about the register's states being saved, and then I figured that maybe the OS was the only thing to only use the real registers, and that the actual processes were given a space in memory to use as fake registers - which to me, IS a virtual machine.
Pah, I dunno.
Posted on 2001-12-28 20:42:58 by ClownHat
Your idea sounds better than mine. Sounds faster.
Posted on 2001-12-28 21:21:36 by ChimpFace9000
Saving and restoring is how it's done.

The register values are saved when switching out of a thread, and the registers are restored when switching back into the thread.

Emulating the x86 is highly undesirable, as you can't use the published optimizations. The 386 and later (includes Pentium) have memory management features that allow an OS writer to create virtual memory.
Posted on 2001-12-28 21:43:18 by tank
I believe that it is the OS's responsiblilty to preserve the registers during a task switch.

Understanding the Linux Kernal by O'Reilly is a good book to read if your into low level behind the scenes.
Posted on 2001-12-29 00:47:55 by eet_1024