The POST Process
The POST Process
The POST Process
description of what your PC must go through between the time you flip on the power switch and the time it is ready for you to run your first application program. This process is called booting the PC, from the whimsical notion of the impossible task of lifting oneself by one's own bootstraps. Fortunately, all PCs (as well as modern, larger computers) come with the capability of getting themselves started without all that fuss and effort by a human being. The reason they are able to do that lies in two features of their architecture. One is a portion of how the x86 processors are designed. The other is in the contents of a particular program that the motherboard BIOS chips contain. Just as Intel hardwired the x86 processors to look in the first 1KB of main memory for the interrupt vector table, they also hardwired the address at which it will look for instructions when it first wakes up. The designated address is exactly 16 bytes below the top of the first megabyte. (An x86 processor can access only the first megabyte of memory address space when it first wakes up, because it always does so in real mode.) So, if the PC maker arranges to have the motherboard BIOS ROM show up in the CPU's memory address space in the region just below 1MB, and if it contains an appropriate program starting at that special address, that boot program will automatically run each time the PC is turned on or reset. Because a PC program normally progresses through memory from lower addresses to higher, and because the starting address is only 16 bytes below the absolute upper end of the first megabyte of memory, it would seem at first glance that the boot program would have to be impossibly short. In fact, the boot program first jumps unconditionally to some address a good deal further below this "ceiling," but still somewhere inside the motherboard BIOS ROM. Next, the boot program determines whether all the standard parts of the PC are present and seem to be working normally. Before it gets very far into this process, it fills in the first 16 slots in the IVT with pointers to ISRs elsewhere in the motherboard BIOS. After that has been done, the boot program enables the maskable interrupts so the machine can respond to, for example, keystrokes from the keyboard. Also along the way, the motherboard BIOS program determines whether a special video BIOS chip is located on a plug-in video card. If it is, the boot program transfers control of the PC to that program, which uses this opportunity to place its ISR addresses into the correct slots in the IVT. When that has been accomplished, the video card can display information on the screen. That video BIOS program commonly displays a copyright message as the first message on the screen. Then it returns control to the motherboard BIOS boot program. The boot program now checks main memory to see how much of it there is, and to be sure it all works correctly. (Some PCs do a more thorough job of checking memory at this stage than others, which explains why some PCs can have flaky memory and yet pass this step in the boot process. They might reveal the deficiencies of the memory at a later stage, either when a memory management program loads and does a more careful check of main memory, or perhaps only by failing in the middle of some important task you are doing.) Around this time, the boot program usually also offers the user a chance to suspend the boot program and enter the BIOS setup program. This enables you to go into a special set of screens that enable you to alter configuration settings stored in the motherboard CMOS. The boot program continues by building some data tables in the DOS and BIOS data area, a region of main memory just above the IVT. This area holds, among other things, a concise record of the number of serial and parallel ports, floppy disks, and other standard pieces of hardware in this PC.
Now the boot program has finished its POST section, and it is ready to look for an operating system and load it into memory. If it succeeds in doing this, it will then turn over control of the PC to that operating system, and the boot program's job will be done. If the boot program cannot find an operating system, it typically will simply stop with a message saying that you should insert a bootable disk in the A: drive and press any key to restart the boot process. In all PCs built more than a few years ago, the boot program would always look for the operating system in a standard set of places and always in the same order. It looked initially on the first floppy disk drive (A:), and then on the first hard drive (C:). If it didn't find an operating system in either of those places, it gave up (or in IBM-brand PCs only, it ran the BASIC interpreter located in a special motherboard ROM). Many modern PCs are more flexible, and in their BIOS setup program, you can tell the PC which devices you want it to check and in what order. The possible boot devices now commonly include the A: and B: floppy disk drives (which could also be the new high-capacity super-floppy drives referred to either as a: drives or LS120 drives), the C: hard drive, or a CD-ROM drive attached to either the primary or secondary IDE chain. Booting through a removable media like the floppy drive can be dangerous if the boot disk is infected with virus. One way to minimize the likelihood of infecting your PC with a so-called boot sector virus is to specify that it not try booting from A: or B:. When you must boot from a floppy, you can simply first enter the BIOS setup program and reset this choice to allow booting from the floppy disk drive, and then be sure that the disk you use is virus-free. System Boot Sequence in Technical Details Stage 1: Turn On Your System Power It takes some time for the internal power supply to "warm up" and generate reliable power in the proper voltages for the entire computer system. In fact, it can take a half-second or longer for the power to be stabilized. If the system is turned on prematurely, it can be damaged. To avoid the potential destruction, the motherboard chipset will generate a reset signal to the processor, which has the same effect of pressing the reset button on your chassis, until a power good signal is sent from the power supply. What exactly is the Power OK signal? It is a signal sent by the power supply after it completes its internal tests and determines that the power is ready for use. The system's motherboard will not start the computer until this signal is received. The nominal voltage of the power good signal is +5 V. Practically speaking, the allowable range is up to a full volt above or below this value. Should a power surge or glitch occur, the power supply will turn off the power good signal until the problem is fixed, causing the computer to be reset. Stage 2: The Processor Is Ready for Executing When the processor first starts, it always looks into the system BIOS ROM for the start of the BIOS boot program. The location that holds the BIOS boot program typically is at FFFF0h, which is at the end of the system memory. Note that these 16 bytes of memory space contain only a "pointer" that points the processor to the real startup program. Stage 3: The BIOS Performs the Power-On Self Test (POST) Keep in mind that POST takes place only during a cold boot, meaning the machine was off when started. During a warm boot, caused by pressing Ctrl+Alt+Delete, the POST is skipped entirely.
During the POST process, the BIOS looks for the video card's built-in BIOS program, which is normally located at C000h in memory. The system BIOS executes the video card BIOS and initializes the video card. At this point, you will see information onscreen about the video card. When the system BIOS startup screen is displayed, the following information can be found:
BIOS manufacturer BIOS version number BIOS date The key(s) to press to enter the BIOS setup program System BIOS logo "Energy Star" logo BIOS serial number
Keep in mind that the serial number is essential, as it can be used in many cases to determine the specific motherboard and BIOS version you use. When the video card is initialized, the BIOS starts looking for the other devices' ROM BIOSes and executes them. For a typical IDE system, the IDE/ATA hard disk BIOS can be found at C8000h. A SCSI device controller might have its own BIOS enabled, and in such case, you will see its information being displayed onscreen as well. There are two types of SCSI cards. Regardless of the card types, all SCSI adapters require the following local resources:
The older cards generally require manual jumper configuration to configure the IRQs, DMAs, and SCSI IDs. The newer cards use n-board BIOS to control the resource settings and automatic SCSI ID assignment. With plug-and-play capabilities, these cards can configure themselves most of the time. Stage 4: Device Detection In addition to running the device BIOSes, extensive checks are performed on other items, such as system memory. You can refer to this as a system inventory. Nowadays all system BIOSes are plug-and-play compliant. All the plug-and-play devices are detected, configured, and displayed. A summary screen about the system's configuration then appears. Any device not shown hasn't been detected. In order to truly support plug and play, the BIOS follows a series of steps to manage the plug-and-play devices. First, it creates a resource table that includes all the available IRQs, DMA channels, and I/O addresses, but excludes those reserved for the system devices. It then looks for the plug-and-play and non-play-and-play devices that reside on the PCI and the ISA buses, identifies them, and loads the last known system configuration from the ESCD. ESCD (Extended System Configuration Data) is stored in a non-volatile CMOS memory area. This ESCD area is used to store configuration information about the hardware in your system. During the system boot, the BIOS checks this area of memory to determine whether changes occurred since the last boot-up. If nothing has changed, no configuration work needs to be done at this stage. Another use of ESCD is to provide a communication link between the BIOS and the OS, as both of them use the same ESCD area to read and record the status of the hardware. In fact, Windows 9X and Me read ESCD to determine whether the hardware has changed so that they can take proper action.
The BIOS compares the current configuration to the last known configuration loaded from ESCD, takes the appropriate actions, and then continues with the boot. The BIOS settings are checked to determine whether any non-plug-and-play devices have reserved additional system resources. These resources are eliminated from the available resource table. After all these steps, the resource table is pretty clean. The BIOS can assign resources to all the PnP cards from the resources left in the resource table. The PnP devices that receive their resources are notified. The ESCD area is updated with the new system configuration. At this stage, you will see the message "Updating ESCD ... Successful" onscreen. Stage 5: System Configuration Summary Prior to booting the operating system from disk, a configuration summary is displayed. Typically you will see the following pieces of information:
Processor (CPU) Type: Sometimes you see -S next to the processor type. This is a power management feature called SMM, which is short for System Management Mode. Note that, although the SMM circuitry is integrated into the chip, it is operating independently to control the processor's power use based on its activity level. Most modern processors support SMM. Coprocessor: This indicates the floating-point unit (FPU). Because all the latest processors have the FPUs built in, you will always see the value "Installed" or "Integrated". Clock Speed: This indicates the speed of the processor in MHz. Floppy Drive A and/or Floppy Drive B IDE/ATA Drives Base Memory Size: This value indicates the 640KB conventional memory. Extended Memory Size: This indicates how much extended memory has been installed in your system. The missing 384KB in between is the upper memory area. In the age of Windows Me, 2000, XP or Linux, you don't really need to pay attention to these base memory/extended memory values. These values are only relevant for DOS or the earlier versions of Windows. Cache Size: The amount of level 2 cache memory on board in the system. Memory Type and Configuration: Information includes the number of memory banks found as well as the type of memory installed. Display Type: This is only a generic value, and you will most likely see the value of "VGA/EGA." Serial Port(s) Parallel Port(s) Plug-and-play Devices
Stage 6: Boot Up The BIOS starts searching for a boot drive. The typical settings found follow this sequence: 1. Floppy disk (A:) 2. Hard disk (C:) 3. CD-ROM drive (D:) This sequence can be altered in the CMOS. How this is accomplished is different from BIOS to BIOS, but there is usually some setting named "boot sequence," or "boot order," which can be cycled through the available devices. Your motherboard or BIOS manual should identify this setting clearly and explain what options your specific PC has. When the target boot drive is identified, the BIOS uses the boot information to start the operating system boot process. Stage 7: OS Boot Process
Most likely your OS is installed on one of the hard disks. The BIOS will look for a master boot record at cylinder 0, head 0, sector 1, which is actually the first sector on the disk. This is the same if you are booting from a floppythe floppy disk has a volume boot sector for booting purposes. The BIOS boots the operating system using information contained in the boot sector. The code contained in the boot sector then takes over the control from the BIOS. If no boot device is discovered, or if the bootable hard disk partition is not set to active, the system will normally display an error message, and then will halt. The Master Boot Record Often referred to as the boot sector, the MBR exists in your hard disk, serving as a consistent starting point where key information is stored about the disk, such as how many partitions it has and what sort of partitions they are. Additionally, MBR holds the information required for the BIOS to load the initial boot program. Located at cylinder 0, head 0, and sector 1, the master boot record contains both the Master Partition Table and the Master Boot Code. The Master Partition Table is a small table that includes the descriptions of the partitions contained on the hard disk. The Master Boot Code represents the small initial boot program executed by the BIOS. This code contains the instructions needed for transferring the execution control to the boot program stored on the OS partition, for the purpose of booting the OS. MBR contains information essential to the boot up process. If it becomes damaged or corrupted, serious data loss can occur. Also, because the master boot code is the first program executed when the PC is on, this is a favorite target for a virus attack. You should install anti-virus software so that protection can be in place. Active Partitions and Multi-Boot Setup On a PC, only an active primary partition can be used to boot an operating system. There is only one active partition on each system. Logical drives within an extended partition can never be designated as bootable. The most popular tool to configure partitions is the DOS FDISK command. You can create and remove primary and secondary partitions with this command. The most important thing to do, however, is to mark a primary partition as active, so that this partition can become bootable. FDISK is available in DOS, Windows 3.X, Windows 9X, and Windows Me. It supports only the FAT family file systems, including FAT12, FAT16, VFAT, and FAT32. Note The following functions can be performed with FDISK: Create Partitions: For creating primary or logical partitions. Set Active Partition: For setting the primary partition on your boot disk to active. Although this is a manual process, FDISK will warn you when none of the disks is active. Delete Partitions: For deleting the existing partitions. Display Partition Information: For displaying partition information without taking any actual actions.
In some cases you might need to host multiple operating systems on the same system. These OSes need to share the same file system in order to coexist. The recommended arrangement is to set up
multiple primary partitions on a one-per-OS basis. You will then have to use a boot manager to control and manage this environment. Boot managers, or boot loaders, are programs that insert themselves into the very beginning of the boot process. When your system boots, the boot manager runs immediately to analyze the primary partitions and present you with an OS menu. The primary partition that belongs to the OS of your choice is marked as active in real time, and the boot process continues. In Windows, System Commander is a famous third-party boot manager product. On Linux, LILO is the de facto boot loader used in most of the Linux distributions. The OS Boot Process When the BIOS completes its startup activities, it starts loading the OS by searching for the boot device in the order specified by the CMOS setting. Once the boot sector is located, the OS continues the boot process. DOS or any variant of Windows other than Windows NT or Windows 2000/XP starts out by booting the equivalent of DOS. For Windows, there are extra steps required at the end of the boot process after the underlying DOS has loaded, listed here: 1. The master boot code examines the master partition table to determine whether there is an extended DOS partition and whether there is a bootable partition specified in the partition table. Any primary and extended partitions must be loaded and recognized by the system. 2. The boot code next attempts to boot the primary partition that is marked active. If none of the partitions is active, you will receive error message such as "No boot device" or "NO ROM BASIC - SYSTEM HALTED" or "Operating System Missing". 3. If an active primary partition exists, it is booted. The boot code loads the volume boot sector into memory and tests it before passing control to the volume boot code. 4. The volume boot code examines the disk structures to ensure that everything is correct, and then searches the root directory of the device being booted for the operating system files that contain the operating system. In the case of DOS, the following files are the search targets: o IO.SYS o MSDOS.SYS o COMMAND.COM 5. If the corresponding operating system files do not exist, you will receive error message such as "Non-system disk or disk error-Replace and press any key when ready". 6. If those operating system files are present, they will be loaded into memory and granted control over the rest of the process. For DOS, the files execute in the following order: o IO.SYS o MSDOS.SYS (this file is a text file under Windows 9X and ME) o COMMAND.COM o CONFIG.SYS and AUTOEXEC.BAT Windows 9X/Me Boot Sequence For Windows 95/98/Me, many more routines are executed afterwards to read the system Registry, initialize hardware devices, and start the graphical interface. The following list summarizes the Windows 9X/Me boot sequence. Files are loaded in this order and their various tasks performed:
IO.SYS: A small DOS core module that starts the Windows 9X/Me boot process and tells the PC to look for the MSDOS.SYS file. MSDOS.SYS: A hidden ASCII text file on the root device that contains information about the boot configuration.
DRVSPACE.BIN: This program checks the integrity of the information in SYSTEM.DAT, which is part of the Registry. Note that DRVSPACE.BIN is also a compression program that allows for disk compression capability. SYSTEM.DAT: This file provides information about the setup of the system, including the different names, locations, and the corresponding drivers of the devices. USER.DAT: Another half of the Registry that contains user-specific information such as screen colors and icon choices. CONFIG.SYS: This file is needed if there are legacy devices to be loaded. AUTOEXEC.BAT: A file for setting system variables and loading TSRs and some other utilities. It is not a strictly necessary file for Windows 9X/Me. SYSTEM.INI: This file contains information about your computer's hardware settings, and is required for loading the various device drivers. VMM32.VXD: This is the virtual machine manager that runs after AUTOEXEC.BAT to load the other virtual device drivers it finds in the Registry and SYSTEM.INI. WIN.COM: This file switches the environment from real mode to protected mode, and then initializes the different devices and performs further file loading. KERNAL32.DLL: The 32-bit kernel for Windows. GDI.EXE/GDI32.EXE: The graphics engines for Windows. USER.EXE/USER32.DLL: The user interface engines. WIN.INI: File that contains application information configuration. STARTUP Group: The Startup folder that contains any programs to be run every time Windows starts.
Windows NT/2000 Boot Sequence The following list summarizes the Windows NT/2000 boot sequence: 1. The file NTLDR, which is the NT Loader, is loaded and executed. 2. NTLDR switches the CPU to 32-bit flat memory mode. 3. NTLDR reads the BOOT.INI file that contains the list and paths of all the installed OSes, and shows you a menu of choices. 4. NTLDR loads NTDETECT.COM to build a hardware list. 5. NTLDR loads NTOSKRNL.EXE, which is the kernel file for Windows NT. 6. NTOSKRNL.EXE loads and initializes Windows NT using information from the Registry. .. The POST Process So what exactly happens when you turn your computer on and it starts up? Your PC performs a series of self-tests, configures itself, and then starts the operating system so you can get work done. Of course, this is an extremely condensed version of what exactly happensso let's take a closer look at this process. As soon as you turn on your PC's power, the power supply performs a self-test to make sure it is operating properly, and then signals POWER OK to the CPU. This signal clears any leftover data from the internal CPU memory registers, and resets another register called the program counter to F000, which tells the CPU where to find the next instruction it needs to process. F000 is the location of the BIOS, or Basic Input/Output System, which instructs the CPU how to interface with the other peripherals in the PC. After the program counter is reset, the CPU performs an initial read and begins to process instructions. The CPU reads from F000 and loads the BIOS, which continues the boot-up. The CPU performs additional cross checks by reading data from different locations and comparing them against the correct values that are permanently encoded into the ROM BIOS.
Once the CPU is satisfied with the results of the cross-checking process, it proceeds to test the system buses, and then tests the RTC, or real-time clock. The RTC acts as the system's "heart," as it were, because all the system signals are synchronized to it. At this point in the boot process, the PC begins to test the video cardand it is at this point where you first start to see some kind of output on your monitor. During this process, the memory on the video board is checked, and the video BIOS is read off the adapter and then inserted into the main system BIOS. After this process is complete, some type of splash screen appears on your monitor, usually containing information about the system BIOS version, processor identification, and other information, depending on your particular computer. Another memory check follows, but this time, the main system RAM is tested. You might see a counter increasing to show you the progress of this test. During this process, the CPU is writing data to different locations in RAM, and then reading the data back from RAM and comparing it against the original values it stored. Once the RAM appears okay, the keyboard is checked--at this point, you might see the lights for the number, caps, and scroll lock keys flash, and depending on your particular configuration, the number lock light might turn back on and stay on. Once the keyboard checks out, the system then proceeds to transmit signals across the system bus to the hard disk drives and floppy drives, and then waits for a response. The installed drives answer back, and the drives are configured for use. After everything is configured, the system then proceeds to crosscheck one last time, comparing the results of these POST tests against the values recorded in CMOS. The CMOS is basically the main repository where the system configuration is stored. If the system finds a different installed configuration than is recorded in the CMOS, the PC will prompt you to press a key and update the configuration on the CMOS setup screens. If your particular machine has a SCSI controller card or other device that has its own BIOS code, it is also read into memory and added to the system BIOS. If present, the system then configures itself via plug and play, assigning interrupts, DMA channels, and other system resources as necessary. Once this final step is completed, the system then searches the disks for a particular piece of program code known as the boot loader. After the boot loader is found, the BIOS copies it into a particular location in RAM (address 7C00, FYI), and then hands off control to the boot loader, which then continues the system start up. Note Sometimes the POST process can take quite a while to finish, especially when you have many devices attached to the computer. In fact, you can save yourself a little bit of time on subsequent bootings by altering a setting in the motherboard BIOS. Watch the screen when your PC starts up to learn how to enter the BIOS. The method varies from machine to machine, but most explain how to do it onscreen early in the POST process. (If that doesn't work, try holding down a key until the PC complains that there is a stuck key. After that message, there is usually a prompt telling you how to enter the BIOS.) In the BIOS, look for an option you can change to enable "fast boot" or to "skip testing memory on startup." In many cases, you will not only cut out the time normally taken to count all the memory locations (and test them), you also will skip testing some other parts that rarely fail, and so don't really need to be retested every time you restart your PC.