On Tue, 7 Jan 2003, Tahir Hashmi wrote:
The reason why real mode is no longer used seems to be that it doesn't offer 32 bit addressing, while that's possible in protected mode.
386DX has 3 modes:
1. Real Mode (for older apps, specifically for 8086/88 support) 2. Virtual Real Mode or Virtual 86 mode(for having (some) protected mode feat. in real mode) 3. Protected Mode
Protected mode has following advantages:
1. Full 32 bit addressing 2. Better interrupt/fault handling (more no. of interrupt conditions possible) 3. Multiuser, Multitasking environment possible because of different previlege levels, task switiching thru call gates and interrupt gates, etc. 4. Data is secure at the hardware level. Non previleged task will not be able to access higher privelege data segment 5. Better memory management
and more ...
However it is interesting to note that whenever 386 is reset it will go into Real Mode by *default* (obviously for DOS and other real mode OSes which dont know about protected mode.)
It is the job of the OS to take 386 from Real to Protected Mode ( maybe by setting the CR0 bit, I'm trying to find this in the Kernel sources :) )
After protected mode has been initialized, kernel loads the IVT (Interrupt Vector Table ), the previlege levels of the data and code segments ( *maybe* this facility is used for user level file acess/execution previleges ) and continues loading the OS.
P.S. But how the Kernel is loaded in first place by the BIOS? Conjecture:
When reset, 386 points to a default location in PROM. ( the location is FFFF0H note: for 8086 compatibility 16 bit address)
The default location then has a subroutine which passes control to the BIOS (a sort of PROM right ?)
Now BIOS performs the IO checks. Afterwards it searches for address (Track 0) of a media (CDROM/HDD/FDD). Now it is expected that Track 0 contains valid OS. (Some Magic Number AFAIK)
Now where does the Bootloader come into picture? ( I dunno pls someone elucidate on this)
Ok lets assume that Bootloader "fools" BIOS in believing that it actually is an OS.
Now control is transferred to the bootloader which according to the option selected loads the kernel of the selected OS. The kernel now continues with its operation....
whew... Can someone pls tell whether this is the right sequence?