Search code examples
cpubootbios

How does the CPU execute instructions stored in a motherboard's flash memory chip?


I have read that at startup, the CPU program counter register is filled with F000.

I thought that:

PC registers contain the next instruction address.
This address is send to the address bus and value return to the data bus

Does the address bus only deal with RAM? Obviously the BIOS isn't stored in RAM.

So how does F000 target the ROM to start BIOS execution?


Solution

  • At power on, the chipset maps the reset vector (0xffff0) to the BIOS ROM. The CPU executes instructions directly off the ROM part using a technique called Execute in Place (XIP). Next, the BIOS can utilize the processor's L2 cache as if it were RAM using a technique called "No Evict Mode", or "Cache-as-RAM". Finally, main system RAM is initialized and an operating system can be loaded. For more information:

    https://en.wikipedia.org/wiki/Reset_vector
    https://en.wikipedia.org/wiki/Execute_in_place

    Beyond BIOS
    Intel® 64 and IA-32 Architectures Software Developer Manuals