0000:7c00 处的内存对于启动顺序有何意义?

发布于 2024-08-17 17:23:48 字数 66 浏览 7 评论 0原文

为什么 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

我的奇迹 2024-08-24 17:23:48

简单的答案是,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.

友谊不毕业 2024-08-24 17:23:48

“:”是分段内存时代的遗留物,当时 PC 以实模式运行,一次只能处理 64K 数据。 “:”左边的数字是您的段,右边的数字是您的地址。

如果您想自己在内存中查看,Windows 调试命令接受此表示法:

C:\Users\Seth> debug
-d0000:7c00
0000:7C00  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C10  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C20  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C30  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C40  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C50  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C60  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C70  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................

关于此特定地址,它只是选择加载 MBR 的地址,请参阅: https://web.archive.org/web/20140701052540/http://www. ata-atapi.com/hiwmbr.html

“如果找到 MBR,则会将其读入内存位置 0000:7c00,并且 INT 19 跳转到内存位置 0000:7c00”

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:

C:\Users\Seth> debug
-d0000:7c00
0000:7C00  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C10  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C20  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C30  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C40  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C50  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C60  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C70  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................

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

"If an MBR is found it is read into memory at location 0000:7c00 and INT 19 jumps to memory location 0000:7c00"

一笑百媚生 2024-08-24 17:23:48

在最初的 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.

风透绣罗衣 2024-08-24 17:23:48

阅读这篇文章:

http://en.wikibooks.org/wiki/X86_Assembly/Bootloaders

从上面的 URL 中,BIOS(实际上是 PC 硬件)将跳转到 0000:7c00 处的内存,以继续以 16 位模式执行。

并引用上面的内容:

引导加载程序在某些条件下运行,程序员必须了解这些条件才能成功创建引导加载程序。下列
与 PC BIOS 启动的引导加载程序相关:

  • 第一部分
    驱动器包含其引导加载程序。
  • 一个扇区为 512 字节 — 最后一个扇区
    其中两个字节必须为 0xAA55(即 0x55 后跟 0xAA),或
    否则 BIOS 会将驱动器视为无法启动。
  • 如果一切都在
    命令,表示第一个扇区将放置在 RAM 地址 0000:7C00 处,并且
    当 BIOS 将控制权转移到 0000:7C00 时,它的角色就结束了。 (即它
    JMP 到该地址)

因此,从启动开始,如果您希望 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:

A bootloader runs under certain conditions that the programmer must appreciate in order to make a successful bootloader. The following
pertains to bootloaders initiated by the PC BIOS:

  • The first sector of
    a drive contains its boot loader.
  • One sector is 512 bytes — the last
    two bytes of which must be 0xAA55 (i.e. 0x55 followed by 0xAA), or
    else the BIOS will treat the drive as unbootable.
  • If everything is in
    order, said first sector will be placed at RAM address 0000:7C00, and
    the BIOS's role is over as it transfers control to 0000:7C00. (I.e. it
    JMPs to that address)

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文