Douglas Evan Cook
Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
What the heck is real and protected mode?
On 5 Dec 1995, Seth Alan Kintigh wrote: Quote> Okay, I thought I knew the difference, but reading through a thread I > discovered I didn't. Could somebody please explain? Thank you.
Real mode is where everything works like you would think it would work... You access memory, it is read or written. An interrupt occurs, and process goes to the handler. You do an OUT or IN to/from a port, and you get the value that really was at that port. Everything is simple... Protected mode is a lot wierder. You access memory, the operating system can redirect your access to wherever it feels like directing it, or gain control so that it can read the requested memory off of the hard disk (allowing virtual memory). If a program tries to access memory that doesn't belong to it, the access fails. An instruction like MOV AX,[1234] if the memory pointed to by DS:1234 had been swapped out, the operating system would get control and read that memory in to a place in real memory. In other words, the operating system can play games with memory, moving it around and whatever else it feels like doing. Interrupts are done a little bit differently, and there are some interrupts that the processor generates, so you have to test to see it it was the processor that generated the interrupt or if it was a programmer executed INT 21 or whatever. Lastly, the operating system can write virtual device drivers, VDD's, so that if a program tries to reprogram a device with IN/OUT instructions, the VDD can pretend that the command was carried out, respond with what the real device would respond with, etc. So then a program could reprogram the VGA card, it would think everything was fine, but it was actually running in a window, so the operating system just changed the way the window looked. Anyway, if you have the tools and the need, protected mode gives a lot of nifty advantages. Otherwise, all of this protection can slow down your computer for no reason. Protected mode allows multitasking and rearranging of memory. Hope this helps.
|