当PC首次启动时,它开始在物理地址0xffff0处执行。该地址包含对BIOS的jmp指令。
现在我的问题是,我总是假设物理地址映射到RAM。如果RAM最初包含垃圾值,那么将jmp指令准确地放在0xffff0中是什么?对于不同的BIOS,jmp指令总是相同还是不同? 0xffff0是否从RAM映射到BIOS然后(意味着它是“硬映射”)?
答案 0 :(得分:20)
前64kB左右映射到BIOS ROM,而不是RAM。
答案 1 :(得分:6)
看看PC boot sequence。正如Ignacio已经回答的那样,它被“硬映射”到BIOS只读存储器。
答案 2 :(得分:5)
查看此英特尔手册:
转到第9-6页及后续页面,它们都描述了CPU的初始启动模式。获取的第一条指令来自ffffff00(硬连线到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。
答案 3 :(得分:4)
实际上,它比这复杂一点。首先,在386以来的任何处理器上,它实际上从fffffff0开始(即,比32位地址空间的顶部短16个字节)。在处理器首次执行远程跳转指令之前,它会执行一些特殊的映射,以使整个32位地址空间可见,即使它在实模式下执行。执行远程跳转后,它将启动“正常”实模式操作。
在任何情况下,在硬件方面,您通常都有(Flash)ROM映射到该位置,因此当它开始执行时,它正在ROM中执行代码。开始执行的不是真正的BIOS - 它只是将实际BIOS从ROM解压缩到RAM中的代码,然后将该RAM重新映射到BIOS地址范围。