当电脑首次启动时,它会从物理地址0xffff0开始执行。这个地址包含一个跳转指令到BIOS。
现在我的问题是,我一直认为物理地址映射到RAM。如果RAM最初包含垃圾值,那么到底是什么将jmp指令放在0xffff0中? jmp指令始终相同还是对于不同的BIOS有所不同? 0xffff0是否从RAM映射到BIOS(意味着它是“硬映射”)?
前64KB左右的空间映射到BIOS ROM而不是RAM。
查看这个英特尔手册:
请前往第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。
FFFF0000-FFFFFFFF
和000F0000-000FFFFF
映射到同一个 ROM 吗? - l4m2