当前位置:网站首页>Do you know how the computer starts?

Do you know how the computer starts?

2020-11-09 01:10:00 Hakou

The last issue was about computer hardware , In this issue, let's take a look at how it starts when you put the hardware together .

Let's start with an introduction : What happens when we press the power button to the screen to display the operation interface ? A lot of people may say that this is just starting the operating system . o , It's not a complete process . If you can't give a general description of how it started , I think this article is for you .

After we press the power button on the chassis , The power supply supplies power to the motherboard , The components on the motherboard are all in power on The state of . Then initialize BIOS System .BIOS The system is a program located on the motherboard , It can control the hardware and the hardware settings ( For example, whether to turn on Virtualization 、 Disk device boot sequence, etc ).

BIOS The system will Burn in a device that won't lose data due to power failure ROM Inside , Generally speaking, the motherboard comes with itself BIOS.

The picture above is more common BIOS Interface , Now the better motherboard is not this style . The machine I'm using now is BIOS The system is similar to the following :

such BIOS Also known as UEFI BIOS, It's the same as before BIOS The biggest difference is Support mouse operation , The picture is more friendly .UEFI BIOS It's ancient BIOS Inheritance and extension , Their relationship is similar to Windows XP And Windows 7. Ancient BIOS Common in notebooks and older PC.

BIOS After the initialization ,CPU Read BIOS The content in . stay X86 Type of CPU After power up ,CPU The physical address will be read 0xFFFF0, And this address corresponds to BIOS Region .

BIOS The job is quite simple , The main job is Perform the host self test (POST), Then find out which disk the operating system exists on , Load the operating system into .BIOS Looking for disks The operating system of , It is mainly to find the first sector on the disk (0 Noodles 0 Magnetic track 1 A sector ), Each sector is 512 byte , If this is a boot sector , Then load it into 0x7C00 On the memory address of , Then jump to this address and execute . If this is not a boot sector , Just keep looking for the next disk , See if there is a boot sector on it . If there is no boot sector on all disks , On the screen Print out an error message .

The boot sector has only A sector is 512 Byte size , So its main purpose is to read the kernel of the operating system into memory , Then jump to the operating system kernel and start executing . From the point of view of writing an operating system , Ahead CPU Power on and BIOS None of the work of the operating system can control , and Start with the boot sector , It can be completely controlled by the operating system 了 , therefore , Writing a boot sector is also writing an operating system One of the necessary jobs . from BIOS After jumping into the boot sector , Computer system boot work is done , How to read the operating system kernel into memory and then arrange a jump instruction to jump to the kernel is the work of the operating system developers .

therefore , The starting process of the computer is :

  1. Press the power button
  2. Power up the motherboard , start-up BIOS
  3. BIOS Start self-test , And find the boot information on each disk
  4. Execute the boot sector program , Start the operating system
  5. The operating system comes from BIOS Take over the computer and start
  6. The operating system boot is complete , The computer is booted up

ps. Welcome to the official account " Hackle ".

版权声明
本文为[Hakou]所创,转载请带上原文链接,感谢