MIT 6.828 Jos Study Note 2. Lab 1 part 1.2:the kernel

Source: Internet
Author: User

Lab 1 part 1:pc Bootstrap

We continue ~

Physical address space for PC

In this section we will delve into how the PC starts. First, let's look at how the physical address space of a PC is usually laid out:

This diagram shows only a portion of the memory space.

  The first generation of PC processors is a 16-bit word-length Intel 8088 processor that can access only 1MB of address space, or 0X00000000~0X000FFFFF. However, this 1MB is not available to users, only the low 640KB (0x00000000~0x000a0000) address space is available to the user program.

The remaining 384KB of high address space is reserved for other purposes, such as (0x000a0000~0x000c0000) is used as a screen display content buffer, the other is used by non-volatile memory (ROM), which will store some firmware, The most important part of this is the BIOS, which occupies the 0x000f0000~0x00100000 address space. The BIOS is responsible for some basic system initialization tasks, such as turning on the video card, detecting the size of the system's memory, and so on. After initialization is complete, the BIOS loads the operating system from a suitable location.

While Intel processors have breached the 1MB memory space, the 16MB,4GB address space has been implemented on both 80286 and 80386, but the architecture of the PC must still retain the structure of the original 1MB address space for backward compatibility. So the address of the modern computer 0x000a0000~0x00100000 interval is an empty, will not be used. So this hole divides the address space into two parts, the first part is from 0x00000000~0x000a0000, called traditional memory. The rest, which does not include voids, is called extended memory. For this 32-bit word processor, the BIOS is typically stored at the top of the entire storage space.

Due to some limitations of the XV6 operating system design, it only utilizes the physical address space of 256MB, which assumes that the user's host has only 256MB of memory.

The ROM BIOS

Now we're going to start using QEMU and GDB to explore the startup process of the PC. First look at how to use the two software to implement the operating system Debug.

  1. first open a terminal and come to the lab directory, enter the command

Make qemu-gdb

At this point, the following information is printed on the screen:

 2. Let's create a new terminal, or come to the lab directory, enter the GDB command, and the screen output information:

  This is actually ready to start debugging!

We're going to look at the bottom 5 lines here.

[F000:FFF0] 0xffff0:ljmp $0xf000, $0xe05b

This instruction is the first instruction that executes the BIOS after the entire PC is booted. Exercise 2: Use GdB's ' si ' command to trace the ROM BIOS to a few instructions and try to guess what it is doing.    But there's no need to figure out every detail. For an analysis of Exercise 2, you can read my blog post: MIT 6.828 Jos Study Note 3. Exercise 1.2http://www.cnblogs.com/fatsheep9146/p/5078179.htmlIn conclusion, we can see that the operation of the BIOS is in the control, initialization, detection of various underlying devices, such as clocks, GDTR registers. and set the interrupt vector table. This is the same as the last two paragraphs of Lab 1 part 1.2. But as the first program that runs after the PC starts, Its most important function is to import the operating system from the disk into memory, and then transfer control to the operating system. so the BIOS at the end of the run will go to detect which device in the current system can find the operating system, usually our disk. It may also be a U disk and so on. When the BIOS determines that the operating system is located on a disk, it will put the first sector of the disk, usually called the Boot zone (boot sector) first loaded into memory, this ScanDisk includes a very important program - boot loader, it will be responsible for completing the entire operating system to import memory from the disk, as well as some other very important configuration work. The last operating system will start running. visible pc boot run sequence is BIOS--boot loader---OS kernel

The above is the entire contents of Lab 1 Part 1, the classmate who has the problem or corrects the mistake, welcome to send to

[Email protected]

MIT 6.828 Jos Study Note 2. Lab 1 part 1.2:the kernel

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.