I know with older machines like 286s, the first 512 bytes loaded from the first sector of the boot drive to 0000:7C00 in memory were run in 16-bit real mode, but what about modern 64-bit architectures?
Edit: I guess this is a wrong question upon thinking about it. The writer of the boot loader is the decider of which mode assembly instructions to use, right? The hardware just does what it's told. Then my question should be, what mode do major OS boot loaders like Windows 7, Mac OS X (the latest) and GRUB on 64-bit machines use?
Answer
All current x86-compatible computers (this includes x64 architecture too, both from Intel and AMD, but not Itanium) execute boot sector code in x86 real mode, exactly like the original IBM PC did 20+ years ago. It is not kernel mode, it's the original segmented mode without memory protection, multitasking, or code privilege levels.
If you can get hold of a floppy drive, put MS-DOS (or FreeDOS) on it, and stuck into today's computer, it will start booting.
It is boot code's task to switch into protected mode, set up memory protection etc. So your guess is partially right. The boot loader starts execution as x86 real mode and switches into protected mode, loads and starts actually executing OS Kernel in "kernel" (ring 0) mode.
For more information, you can visit Wikipedia article on Windows NT startup process, which has quite a few details on this subject.
No comments:
Post a Comment