System Initialization (x86)

From OSDev.wiki
Revision as of 22:49, 14 February 2007 by osdev>Jhawthorn
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Power Supply Self-Check

The first is a check done by the power supply to determine if internal voltage and current levels are valid. Next is a check done by the BIOS (Basic Input/Output System) program, which mainly concerns the existance of vital computer components such as the Central Processing Unit (CPU), Random Access Memory (RAM) and any Video (Graphics) Cards. If you have ever started your computer and have it immediately spew out a weird series of beeps at you, one of those vital components is damaged or not installed correctly (if at all).

Find Basic Hardware

Once those basic checks are done, the BIOS searches for any adapters that contain their own ROM chips. ROM chips on adapters are used to store vital code that specifies how to run that adapter. If the BIOS finds any of these adapter ROM chips, they are mapped (not loaded) into the physical memory. One prime example is the video card adapter ROM, once executed it usually displays the video card manufacturer and detailed hardware info such as how much RAM is on the video card.

POST

Next is the POST (Power-On Self-Test). This process involves further tests of computer hardware. The main concerns of the POST is a working video card adapter, a functional BIOS program and memory integrity tests. Newer generation BIOS programs also have further tests such as automatic hard drive detection. Most of these tests you will see on the video display output in some form.

Loading the MBR

All the processes discussed so far brings us to the point where control of the computer at the lowest level is finally available to whomever programs it. Here is where the BIOS program loads the Master Boot Record (MBR) from the first device specified in the BIOS setup. A typical device boot order is from the floppy drive (A), then from the first hard drive (C). Newer BIOS programs include booting from such things as CD-ROM, zip drives and from a network. The BIOS will load the MBR into RAM at physical memory address 0000:7C00. It isn't necessary for you to understand what that memory address means yet.

Once the MBR is loaded into RAM, the BIOS program checks for a specific pattern which consists of two bytes at the end of the MBR in the form of 0x55AA. This special pattern is nothing more than a way of telling the BIOS program that "this" MBR was meant to be booted from. If the BIOS program cycles through all available boot device MBRs and doesn't find that special pattern, the computer will hang after the POST with a messages along the lines of "no ROM BASIC", "no valid disk found" or "invalid boot device". If the BIOS program does find this special pattern then processor execution control is given to that MBR program.