0000:7c00 处的内存对于启动顺序有何意义?
为什么 BIOS 读取分区引导记录的位置为 0000:7c00 ?该地址有什么特别之处? ':' 在引用地址时做什么?
Why does bios read at partition's boot record at 0000:7c00 ? What is special about that address ? what ':' doing in referencing an address ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
简单的答案是,7C00h 是距原始 32k 安装内存底部的 1k(512 字节用于引导扇区加上额外的 512 字节用于可能的引导扇区使用)。
令人高兴的答案是,
org 7C00h
已成为引导扇区 - 引导加载程序编程的代名词。The simple answer is that 7C00h is 1k (512 bytes for the boot sector plus an additional 512 bytes for possible boot sector use) from the bottom of the original 32k installed memory.
The happy answer is that
org 7C00h
has become synonymous with boot sector - boot loader programming.“:”是分段内存时代的遗留物,当时 PC 以实模式运行,一次只能处理 64K 数据。 “:”左边的数字是您的段,右边的数字是您的地址。
如果您想自己在内存中查看,Windows 调试命令接受此表示法:
关于此特定地址,它只是选择加载 MBR 的地址,请参阅: https://web.archive.org/web/20140701052540/http://www. ata-atapi.com/hiwmbr.html
The ":" is a holdover from segmented memory days, when PCs ran in real mode and could only do 64K at a time. The number to the left of the ":" is your segment, the number to the right is your address.
The windows debug command accepts this notation if you want to poke around in memory yourself:
With regard to this particular address, it's just an address that was picked to load the MBR, See: https://web.archive.org/web/20140701052540/http://www.ata-atapi.com/hiwmbr.html
在最初的 IBM PC 中,超过 32K RAM 被认为是不可想象的。在分段寻址术语中,这是 0000:8000,其中 8000 十六进制是十进制 32768。当时流行的做法是 BIOS POST 通过将软盘的引导扇区加载到 A: 或将硬盘驱动器的主引导记录加载到 C: 中来结束,位于内存顶部下方 512 字节的位置,这意味着从十六进制中减去 0200 8000 十六进制得到 7C00。因此,引导序列将第一个有效的 512 字节第一个扇区加载到其中,然后将指令指针设置为 0000:7C00 来执行它。我曾经为这些第一个扇区编写代码来加载操作系统。
In the original IBM PC it was thought inconceivable to have more than 32K RAM. In segmented addressing terms this is 0000:8000 where 8000 hex is 32768 decimal. The fashion of the time was for the BIOS POST conclude by loading the Boot Sector of the floppy in A: or the Master Boot Record of the hard drive in C: at the location 512 bytes below the top of memory which means subtract 0200 hex from 8000 hex to get 7C00. So the boot sequence loaded the first valid 512 byte first sector into, and then set the Instruction Pointer to 0000:7C00 to execute it. I used to write the code for these first sectors to load the operating system.
阅读这篇文章:
http://en.wikibooks.org/wiki/X86_Assembly/Bootloaders
从上面的 URL 中,BIOS(实际上是 PC 硬件)将跳转到 0000:7c00 处的内存,以继续以 16 位模式执行。
并引用上面的内容:
因此,从启动开始,如果您希望 CPU 开始执行您的代码,它必须位于内存中的 0000:7c00 处。这部分代码是从硬盘的第一个扇区加载的——也是由硬件完成的。并且仅加载第一个扇区,代码的其余部分必须由该初始“引导加载程序”加载。
有关硬盘第一个扇区和 7c00 设计的更多信息:
http://www.ata-atapi.com /hiwdos.html
http://www.ata-atapi.com/hiwmbr。 html
请不要与 CPU 的启动模式混淆 - 它将获取并执行的第一条指令位于物理地址 0xfffffff0(参见第 9-5 页):
http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-3a-part-1-manual。 pdf
并且在这个阶段它正在执行非易失性(意味着您无法轻松地对其进行重新编程,因此不属于引导加载程序的责任)BIOS 代码。
Read this article:
http://en.wikibooks.org/wiki/X86_Assembly/Bootloaders
From the above URL, BIOS (which is effectively PC hardware) will make the jump to memory at 0000:7c00 to continue execution in 16-bit mode.
And to quote from above:
So from bootup, if u want the CPU to start executing your code, it has to be located in memory at 0000:7c00. And this part of the code is loaded from the first sector the harddisk - also done by hardware. And it is only the first sector which is loaded, the remaining of other parts of the code then have to be loaded by this initial "bootloader".
More information on harddisk's first sector and the 7c00 design:
http://www.ata-atapi.com/hiwdos.html
http://www.ata-atapi.com/hiwmbr.html
Please don't confuse with the starting up mode of the CPU - the first instruction it will fetch and execute is at physical address 0xfffffff0 (see page 9-5):
http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-3a-part-1-manual.pdf
and at this stage it is executing non-volatile (meaning you cannot reprogram it easily, and thus not part of bootloader's responsibility) BIOS code.