Do normal x86 or AMD PCs run startup/BIOS code dir

2019-03-15 08:20发布

I understand modern computers have modified Harvard architectures.

Can the fact that they can read instructions from somewhere other than where they hold data allow them to fetch instructions directly from ROM chips? Do they load the BIOS to RAM first, or do they execute it directly from the chip? I don't have a computer I can open nearby, so... If I remove ALL the RAM from the memory slots, will the computer be able to start the full BIOS, run the POST stuff and tell me I need RAM? It's funny I've never tried it...

EDIT: my intention with this question is to learn whether commercial CPUs (or at least intel cpus) can execute code directly from ROM. It's not for practical purposes, it's to increase my understanding of computer architectures and stuff. The removing-RAM-part is not my main doubt, just an example

2条回答
Evening l夕情丶
2楼-- · 2019-03-15 08:52

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.
查看更多
三岁会撩人
3楼-- · 2019-03-15 09:01

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.

查看更多
登录 后发表回答