Detailed description of PC power-on startup process

Source: Internet
Author: User

I. Understand several concepts

1. What is IRQ?

IRQ is what we usually call interruption. Interruption is an important interface for communication between the core part of a computer and peripheral devices. The "interruption" means that no matter what the core part is doing, it must be stopped, is to execute a section specially designed for this peripheral deviceProgram. For example, every time we press the keyboard, there is a keyboard interrupt, And the CPU has to stop the work at hand to handle it. record which key has been pressed, if you need to press this key to correspond to an operation, you must first perform this operation. After that, you can resume the work. The same is true for MODEM connected to the serial port. when data is uploaded from the telephone line, this serial port will interrupt the system, and the CPU will stop. First, collect the data and put it in a safe place. You can writeArticle, While downloading data from the internet, it depends on the normal operation of interruption. If there is a conflict between the keyboard and modem, that is, if the keyboard and modem are used together, the computer cannot determine whether the data just arrived is from the keyboard or modem, it is possible that the data received by modem is input from the keyboard, and a lot of messy characters are entered in the article you are writing. If the interruption of the video card conflicts with the interruption of the IDE hard disk controller, it is more dangerous. Therefore, to ensure normal operation of the computer, the interruption must be reasonably allocated to the peripheral devices so that they do not conflict.

2. What is int19?

Int19 is interrupt 19, it is a soft interrupt type in the ROM-BIOS, the role is the system self-lifting, that is, the boot loader for cold start.

3. What is bios?

BiOS (Basic Input/Output System), which is the underlying layer that deals directly with hardwareCodeIt provides basic functions for the operating system to control hardware devices. BiOS includes the BIOS of the system BIOS (commonly referred to as the motherboard BIOS), the video card bios, and other devices (such as the IDE controller, scsicard, or Nic, the BIOS is generally stored in the ROM (read-only storage chip), and the Code will not disappear even after it is shut down or powers down.

4. Memory Address Concept

Generally, 32 MB, 64 MB, or MB memory is installed on our machines. Each byte of these memory is assigned an address so that the CPU can access the memory. The 32 MB address range is expressed as 0 ~ in hexadecimal notation ~ 1 ffffffh, where 0 ~ Fffffh's low-end 1 MB memory is very special, because the first 8086 processor can access a maximum of 1 MB of memory, which is known as the basic memory at the low end of 1 MB 640kb, while a0000h ~ Bffffh must be retained for the display card. c0000h ~ Fffffh is reserved for the BIOS. The system BIOS usually occupies 64kb or more space ~ At c7fffh, the BIOS of the IDE controller is in c8000h ~ Cbfffh.

Ii. Computer Startup Process

Step 1: When we press the power switch, the power supply starts to power the motherboard and other devices. The voltage is not stable yet, the control chipset on the motherboard sends a reset signal to the CPU and enables the CPU to automatically return to the initial state. However, the CPU does not execute commands immediately at this moment. When the chipset detects that the power supply has begun to stabilize the power supply (of course, the process from unstable to stable is only a matter of an instant ), it removes the reset signal (if you manually press the reset button on the computer panel to restart the machine, the chipset removes the reset signal when the button is released ), the CPU immediately starts executing commands from the address ffff0h. From the previous introduction, we can see that this address is actually within the system BIOS address range, whether it is Award bios or ami bios, here is just a jump command, jump to the real startup code in the system BIOS.

Step 2: The first thing to do with the startup code of the system BIOS is to perform post (power-on self test, self-check after power-on ), the main task of post is to detect the existence and normal operation of some key devices in the system, such as memory and video card devices. Since post is the earliest detection process, the video card has not been initialized yet. If the system BIOS finds some fatal errors during the post process, for example, if the memory is not found or the memory is faulty (only KB of general memory will be checked at this time), the system BIOS will directly control the speaker voice to report the error, the length and number of sounds indicate the type of errors. Under normal circumstances, the post process is very fast and we can hardly feel its existence. After the post process is completed, other code will be called for more complete hardware detection.

Step 3: The system BIOS will look for the BIOS of the video card. As mentioned above, the starting address of the ROM chip storing the video card BIOS is usually located at c0000h, after the system BIOS finds the video card bios, it calls its initialization code. The video card BIOS initializes the video card. At this time, most video cards will display some initialization information on the screen, introduce the manufacturer, graphics chip type and other content, but this picture is almost a flash. The system BIOS then looks for the BIOS program of another device. After finding the program, you also need to call the initialization code in the BIOS to initialize the relevant device.

Step 4: after finding the BIOS of all other devices, the system BIOS displays its own boot screen, including the type, serial number, and version number of the system BIOS.

Step 5: The system BIOS detects and displays the CPU type and operating frequency, starts testing all ram, and displays the Memory Test Progress on the screen, we can choose to use a simple and time-consuming or detailed testing method in the CMOS settings.

Step 6: After the memory test is passed, the system BIOS will start to detect some standard hardware devices installed in the system, including hard disks, CD-Rom, serial ports, parallel ports, and soft drives, in addition, the vast majority of newer versions of the system BIOS also need to automatically detect and set the memory timing parameters, hard disk parameters and access mode.

Step 7: After the standard device is detected, the plug-and-play code in the system BIOS starts to detect and configure the plug-and-play devices installed in the system, after a device is found, the system BIOS displays the device name, model, and other information on the screen, and allocates resources such as interrupt, DMA channel, and I/O port to the device.

Step 8: by now, all hardware has been tested and configured. Most system BIOS will be refreshed and a table is displayed on the top of the screen, it roughly lists the various standard hardware devices installed in the system, the resources they use, and some related working parameters.

Step 9: The system BIOS will update the escd (extended system configuration data, extended system configuration data ). The escd is a means for the system BIOS to exchange hardware configuration information with the operating system. The data is stored in CMOS (a small block of special ram, powered by a battery on the motherboard. Generally, the escd data is updated only after the hardware configuration of the system is changed. Therefore, we do not see "Update escd... Success ", however, the BIOS of some motherboard uses a different data format than Windows 9x when saving escd data, therefore, Windows 9x will change the escd data to its own format during its own startup, but even if the hardware configuration does not change during the next startup, the system BIOS will also change the escd data format back, so that the loop will cause the system BIOS to update the escd every time the machine is started, this is why some machines will display relevant information each time they are started.

Step 10: After the escd is updated, the startup code of the system BIOS performs its last task, that is, starting from a floppy disk, hard disk, or optical drive according to the boot sequence specified by the user. Take disk C as an example. The system BIOS will read and execute the Master Boot Record on the hard disk. The Master Boot Record will then find the first active partition from the partition table, then read and execute the Partition Boot Record of the active partition, And the Partition Boot Record reads and executes Io. sys, which is the most basic system file for DOS and Windows 9X. Windows 9x Io. sys first needs to initialize some important system data, and then shows the familiar blue sky and white clouds. In this picture, Windows will continue to perform dos and Gui (graphic user interface) partial boot and initialization work.

If a tool or software is installed in the system that directs multiple operating systems, the Master Boot Record is usually replaced with the boot code of the software, which allows you to select an operating system, then read and execute the basic Boot Code of the operating system (the Basic Boot Code of DOS and Windows is the Partition Boot Record ).

The above describes the various initialization tasks that need to be completed by the computer when the power switch (or press the reset key) is enabled for cold start, if we press CTRL + ALT + DEL in DOS to perform Hot Start (or restart the computer from Windows), the post process will jump over and start directly from step 3, in addition, the CPU and memory test in step 5 will not be performed.

3. Interrupt the 19 pilot program loading process

The above is the detailed process of the computer from pressing the power switch to the appearance of blue sky and white clouds into the operating system, so where is the 19 boot interrupted? This is also a problem that has plagued me all the time. The main reason is that it is not very clear about the function of Interrupt 19. First, we should know that it is used to guide the Operating System. Below is a detailed process of it:

Note that in step 10, after the escd is updated, the startup code of the system BIOS performs its last task, that is, starting from a floppy disk, hard disk, or optical drive according to the boot sequence specified by the user. Take disk C as an example. "The system BIOS will read and execute the Master Boot Record on the hard disk !!!", Please note that, how does the system BIOS read and execute the Master Boot Record on the hard disk? It calls 19 program interruptions here!

The first partition is the c disk of the primary partition, in which the first sector (sector at cylinder 0, head 0, Sector 1) the Master Boot Record (MBR) is stored )). When starting from the hard disk, int 19 tries to read MBR. If MBR is found, it is read to the memory address 0000: 7c00 and INT 19 to the memory address 0000: 7c00. A small program in this MBR will try to find a bootable partition. if it finds that the partition can be started, the startup sector will be read to the memory address 0000: 7c00 and this MBR Program (now MBR program, now int 19) jumps to the memory address 0000: 7c00. in this way, you can start.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.