Do normal x86 or AMD PCs run startup/BIOS code directly from ROM, or do they copy it first to RAM? [closed]

独自空忆成欢 提交于 2019-12-03 02:23:58

It both directly executes from ROM and copies stuff into RAM.

On a modern x86 processor, the chipset memory controller is uninitialized at initial power-up, so there is no RAM available.

A modern BIOS is usually divided into two parts:

  1. Boot Block (early POST)
  2. Compressed Area (mid-to-late POST)

When the processor comes out of reset, it begins executing instructions at a fixed address in memory, called the "reset vector". The BIOS flash chip is mapped to this address in memory. The processor simply starts executing instructions from this address.

The "Boot Block" refers to the BIOS code starting at the reset vector (plus a few JMPs). This is executed directly from ROM (memory controller isn't up yet), so it is very slow.

The BIOS Boot Block generally does the following:

  1. Initialize the memory controller. (If you get a "memory not detected" beep code from a motherboard, it happens here.)
  2. Perform a checksum on the Compressed Area to make sure the rest of the BIOS is free of corruption.
  3. Jump into a Recovery Mode if any corruption is detected.
  4. If the checksum passes, decompress the rest of the BIOS into RAM somewhere (typically below the 1MB boundary).
  5. Jump to the decompressed code in RAM and continue with boot.

If you remove the RAM completely the PC should start to beep incessantly when you turn it on.

Here is a good description of what happens: http://www.pcguide.com/ref/mbsys/bios/boot.htm

There's also Hans-Peter Messmer's 'The Indespensible PC Hardware Book' that describes the process too.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!