0.11 Way (ii): Load Setup

Source: Internet
Author: User

After the BIOS bootsect this bootloader into memory, the next step is to load the second and third batches of programs by Bootsect.

The first thing Bootsect do is to plan for memory .
In real mode, the maximum addressing range is 1MB (0xFFFFF). About the Setup program, In Bootsect.s, you specify the number of sectors of the Setup program and the location to which it is loaded (0x90200), and also specify the location where the boot sector (that is, BOOTSECT.S) is loaded by the BIOS (0X07C00) and the new location to be moved (0x90000), where the kernel is loaded (0x10 000) and the end of the kernel, the root file system device number (root_dev=0x306, the first partition of the second hard disk).
This is memory planning to ensure that there is no overlap.

The first step in Bootsect is to copy itself from the 0X07C00 location to the 0x90000 location.
The second step is to load the Setup program into memory.

Loading bootsect,bios requires an int 0x19 this interrupt vector. To load Setup, use the Interrupt service program-the disk service program-that the BIOS provides for the int 0x13 interrupt vector. The difference is that the boot loader that the int 0x19 points to is performed by the BIOS, and the disk service program that the int 0x13 points to is the boot code of the Linux itself Bootsect executes. The former is only responsible for loading the code of the first sector into the 0X07C00 location, while the latter's interrupt service program loads the code of the specified sector into the specified location of memory according to the designer's intent. Therefore, for the int 0x13, the specified sector, the loaded memory location, etc. are passed to the interrupt service program beforehand.

The starting position of the copied bootsect is 0x90000, which takes up 512B, so 0x90200 is next to Bootsect's tail, so bootsect and setup are connected together. The Setup program occupies four sectors, and with bootsect, a total of five sectors are loaded. After the Bootsect code executes, Setup starts.

0.11 Way (ii): Load Setup

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.