Boot. s in Linux kernel full analysis

Source: Internet
Author: User
Boot. s: Linux general technology-Linux programming and kernel information. Today, we finally read boot. s in Chapter 4th of Linux kernel complete analysis, which has been difficult for a few days. It was a little excited, so I wrote it as a souvenir.

1. First, the BIOS automatically loads the program (that is, boot) in the boot area to 0x7C00 in the memory when starting the computer;

2. The system jumps to 0x7C00 of the memory to start executing the boot program;

3. In boot, the kernel code program (head program) that follows the boot zone (after boot) is first loaded to 0x1000 of the memory through the 0x13 hard disk IO interrupt;

4. boot then uses the cyclic Copy command rep movw to copy the head from 0x1000 of the memory to 0x0000 of the memory; (here, the rep movw circular Copy command is used to copy the command from DS: SI to ES: DI based on the number of times set in the CX register, and the entire command is like a single command, so that NMI interruption cannot occur in this copy process)

5. Set GDTR to set the descriptor of both the code segment and Data Segment to point to the memory 0x0000;

6. boot uses the inter-segment jump command jmpi to jump to the code segment at memory 0x0000 and start executing head kernel code.

Original Author: Lai qiulin

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.