Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Who loads the BIOS and the memory map during boot-up

For the BIOS, Wikipedia states:

The address of the BIOS's memory is located such that it will be executed when the computer is first started up. A jump instruction then directs the processor to start executing code in the BIOS.

I know that BIOS lives in non-volatile memory. But it would have to be loaded into the RAM for it to be executed. So who loads the BIOS into RAM ?

I have also read that a memory map is loaded at start-up. Does the BIOS load this memory map ? Where is is stored ?

like image 939
Cygnus Avatar asked Dec 31 '13 17:12

Cygnus


People also ask

Does BIOS get loaded into RAM?

The BIOS then starts the boot sequence. It will look for the operating system. If you don't change any of the settings, the BIOS will fetch the operating system from the hard drive and load it into the RAM. The BIOS then transfers control to the operating system.

How does the CPU load the BIOS?

During the process of booting, CPU reads address of system BIOS from the Reset Vector and jumps to the location where BIOS is stored. My question here is: *As BIOS is stored on some external memory like EEPROM (and not on main memory) , how does CPU access this external memory ?

Which program loads the OS in to the RAM while booting?

The bootstrap loader, or boot loader, is a small program that has a single function: It loads the operating system into memory and allows it to begin operation.

What is the information that BIOS copies on to the RAM?

The reason is because RAM is faster than ROM, so it speeds things up to copy it to RAM and run it from there. Note that the copy isn't done by some magic circuitry, it is just done by the bios itself when it starts executing out of ROM initially, it just copies itself to RAM and then continues executing from there.


1 Answers

At initial power on, the BIOS is executed directly from ROM. The ROM chip is mapped to a fixed location in the processor's memory space (this is typically a feature of the chipset). When the x86 processor comes out of reset, it immediately begins executing from 0xFFFFFFF0.

However, executing directly from ROM is quite slow, so usually one of the first things the BIOS does is to copy and decompress the BIOS code into RAM, and it executes from there. Of course, the memory controller must be initialized first! The BIOS takes care of that beforehand.

The memory map layout will vary from system to system. At power-on, the BIOS will query the attached PCI/PCIe devices, determine what resources are needed, and place them in the memory map at the optimal location. If everything is working properly, memory-mapped devices should not overlap with RAM. (Note that on a 64-bit system with >3GB of RAM, things get complicated because you need a "hole" in the middle of RAM for your 32-bit PCI/PCIe devices. Some early x64 BIOSes and chipsets had issues with this.)

like image 102
myron-semack Avatar answered Sep 26 '22 07:09

myron-semack