我正在编写内核;在编写如此复杂的东西之前,我认为对内核、引导加载程序、寄存器、BIOS 等进行一些理论阅读不仅会有所帮助,而且是必要的。
This article说(我引用):
The boot sector loader.
This loads the first 512-byte sector from the boot disk into RAM and jumps to it.
然后它继续说:
The first sector of a diskette can be loaded at address 0000:7C00.
因此,引导扇区加载程序将位于内存地址 0x7C00(如果我没记错的话)的软盘数据的 512 字节加载到 RAM 中;现在,我的问题是:
- 由于机器正在启动,RAM 必须是空的,所以引导加载程序加载到 RAM 的 0x0000 处?
- (与本文无关)是否有任何方法可以获取 GRUB Legacy (v .9x) 引导加载程序的源代码解释?
- 最后,我应该阅读哪些文章/书籍来熟悉 Kernel 等?
我有 6 年的编程经验,但他们都是在内核使之成为可能的系统上使用高级语言。
感谢任何帮助。谢谢! :)
最佳答案
... the boot-sector loader loads the 512 bytes of the data of a diskette which resides at the memory address 0x7C00 (if I am right) into the RAM
...
Since the machine is booting up, the RAM has to be empty, so the bootloader it loaded at 0x0000 of the RAM?
没有。 0000:7C00
指的是一个RAM 地址。 RAM的意思是“Random Access Memory”,意思是内存中的每个位置都可以直接访问。没有什么比“空 RAM”更好的了。也可以引用INT13中断函数"Read Sectors From Drive" : 其中一个参数(在 ES:BX
中传递)需要指向将存储扇区内容的目标地址。因此,BIOS 所做的是从驱动器加载 512 个字节并将其存储到 0000:7C00
到 0000:7DFF
,然后跳转到 0000:7C00
执行主引导加载程序代码。
Any articles/books I should read to get myself familiar with Kernels, etc?
这个 Wiki 非常有用:http://wiki.osdev.org/Main_Page .启动过程看http://wiki.osdev.org/Boot_Sequence .
关于linux - BIOS是否将512字节的bootloader复制到0x7c00,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32174806/