June 8th, 2002, 06:48 PM
a doubt in processor modes
this is an unlikely place to post this..but i hope i will get some help
i have been fightng with the intricacies of real mode and protected mode operation for some time now..i have a few downloaded materials..but they are too technical.and none of them address why a processor wakes up in real mode and then the booting OS switches the processor to protected mode? some people told me that it is done so as to please the BIOS..but that didnt seem to me like a reasonable answer and i believe it isnt the answer..
a few others told me that the intel CPU from 286 onwards have a dual personality to be compatible with pre-286 software and at the same time support the new software that sees a virtual address..now that i think is a reliable answer..
now here are a few questions i have
Q1) when a processor is running in protected mode(as all processors that support virtual memory do) and if the user wants to run an application that uses the old segmentffset form of the 8086, does the processor switch to real mode or does the OS executes the application in a virtual real mode environment?either way what is the necessity for a processor to wake up(that is before the OS booting) in real mode?
Q2) the following are my deductions after studying the way programs are compiled..they could be wrong and so it will be very helpful if someone could correct it.and so the assumption goes like this
when i compile a C program i get an object code..and finally when it is linked the program is converted into an executable format(for example ELF in linux)..this format as part of the header contains precise instructions regarding the virtual address(the address that,theoretically, starts from 0 and extends all the way till the size of your RAM+swap) that the program sees..this virtual address may also be referred to as logical address..this virtual address is then converted into a linear address..and finally this linear address is mapped into real physical pages in the computers memory...
if there are any mistakes in the above assumption please correct them and if possible please do provide the reasons...
June 9th, 2002, 06:25 AM
286 and later processors start in real mode
inorder to remain compatible with the original
8086 processor. This design was probably
for business reasons. Intel could have designed
other powerful processors (and they have), but
if they did not wake up in 8086 compatible real mode,
most of the old PC software wouldn't run on it.
This doesn't seem to be a bad thing today, (who is still
running software from 1983?) but it would have been
suicide in 1983 to make the next generation chip
incompatible with all existing PC software.
Yes, all these later chips have a "split personality"
because of this.
The 286 apparently had no practical way to go back
to real mode from protected mode, unless you rebooted.
Few people ran them in protected mode, it was too
The 386 and later processors have another mode
called V86 or virtual 8086 mode, and is a sub-
feature of protected mode.
When you run a "real mode" program within
a protected mode OS, it sets up an 8086 virtual machine
complete with an 8086 compatible OS, so that the program
sees a virtual PC, complete with segment/offset addressing
As for "satisfying the BIOS", this is also true.
No one has been willing to write a BIOS that
would fail to be backward compatible, and so the
processor has to execute 16 bit real mode code
during the boot process, in order to use a backward
compatible BIOS whos routines are all 16 bit
real mode code.
Real mode is something that everyone wishes would
go away, but no one wants to be the first one to build
a new computer that makes a radical break with a
20 year legacy of backward compatibility.
I came in to the world with nothing. I still have most of it.
June 9th, 2002, 09:08 AM
thanks a lot rcgreen..it did make a few things clear to me...thank you very much