The relationship between bootloader and real mode to protected mode?

the relationship between bootloader and real mode to protected mode? Recently, I have been studying the operating system, and then I have read several books, 30-day self-made operating system and the implementation of an operating system. In fact, I prefer the relevant knowledge at the bottom of the computer, and I also think that it would be nice if I could write some operating system kernels, but there have been many problems about operating system startup, such as the relationship between bootloader and real mode to protected mode. I wish I could understand a lot of these things. In fact, I have studied compilation, but I just can"t understand a lot of things. In theory, I think that in the 512 boot sector of the boot disk, why not just jump to the operating system kernel in this 512 sector? Why does it involve a lot of real mode, protected mode and bootloader, which makes me very confused, and I don"t understand the relationship between bootloader and real mode to protected mode? An operating system implements this book, which writes a lot of things from real mode to protected mode, but does not quite understand it, and the progress is very slow.


the switching action of XP is done in NTLDR, but unlike what you understand, it does not mean that switching to protected mode is OK at once, but switching back and forth between real mode and protected mode many times. The reason is: there is no hard drive in NTLDR, reading the disk is achieved through INT 13, and INT 13 can only be used in real mode, what should I do? So NTLDR first calculates the location of the sector to be read (in protected mode), then switches to real mode to call INT 13, and returns after reading it. Because INT 13 is called frequently, it will switch between protected mode and real mode many times, this design has been like this from Win2000 to XP, because Win2000 and NT4 have source code leakage, you will see. If it is a mixture of XP and Win7 (pre-installed XP), also has a similar action. Do not completely switch to protected mode until all read requests have been processed.

author: Arctic
link: https://www.zhihu.com/questio.
Source: Zhihu
copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please indicate the source.

turn around for your reference

Menu