0xffff0 and the BIOS

9

当电脑首次启动时,它会从物理地址0xffff0开始执行。这个地址包含一个跳转指令到BIOS。

现在我的问题是,我一直认为物理地址映射到RAM。如果RAM最初包含垃圾值,那么到底是什么将jmp指令放在0xffff0中? jmp指令始终相同还是对于不同的BIOS有所不同? 0xffff0是否从RAM映射到BIOS(意味着它是“硬映射”)?

4个回答

23

前64KB左右的空间映射到BIOS ROM而不是RAM。


7
请看PC启动顺序。正如Ignacio已经回答的那样,它被“硬映射”到BIOS只读存储器中。

6

查看这个英特尔手册:

http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-3a-part-1-manual.pdf

请前往第9-6页以及后续页面,这些页面将描述CPU的初始启动模式。第一个获取的指令是来自fffff00(硬连接到ROM BIOS)的指令:

The first instruction that is fetched and executed following a hardware reset is
located at physical address FFFFFFF0H. This address is 16 bytes below the
processor’s uppermost physical address. The EPROM containing the software-
initialization code must be located at this address.

记住,此时仍处于实模式:

The CS register has two parts: the visible segment selector part and the
hidden base address part. In real-address mode, the base address is normally
formed by shifting the 16-bit segment selector value 4 bits to the left to produce a
20-bit base address. However, during a hardware reset, the segment selector in the
CS register is loaded with F000H and the base address is loaded with FFFF0000H. The
starting address is thus formed by adding the base address to the value in the EIP
register (that is, FFFF0000 + FFF0H = FFFFFFF0H).

然后再仔细看,图9-3中是64K内存的位置——从ffffffff到ffff0000,并指示那里是EPROM或系统BIOS,因此不是RAM。

enter image description here

请参见图8.4: http://www.iakovlev.org/index.html?p=946


FFFF0000-FFFFFFFF000F0000-000FFFFF 映射到同一个 ROM 吗? - l4m2
抱歉,我不理解你的问题。为什么你这么说? - Peter Teoh
因此它们映射到相同的ROM。 - l4m2

4
实际上,这比那要复杂一些。首先,在任何自386以来的处理器上,它实际上从ffffffff(即32位地址空间顶部少16字节)开始。在处理器首次执行远跳转指令之前,它会进行一些特殊映射,使整个32位地址空间可见,尽管它正在执行实模式。在执行远跳转后,它开始进行“正常”的实模式操作。
无论如何,在硬件方面,通常将(Flash) ROM映射到该位置,因此当它开始执行时,它正在ROM中执行代码。但实际上启动时执行的并不是BIOS,而只是用于将真正的BIOS从ROM解压缩到RAM的代码,然后重新映射该RAM到BIOS地址范围。

BIOS ROM 映射的是 Flash 还是 EEPROM? - ransh
@ransh:Flash是一种EEPROM,所以这不是一个非此即彼的问题。至少在大多数典型情况下,它是Flash。 - Jerry Coffin

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接