There were a few blogs detailing Xen's memory initialization, and it really felt like this was a pretty complicated piece of content. These two days to see the Linux kernel boot memory initialization, is also looking at the fog, want to try to read the next write, in the process of writing a blog slowly thinking, and finally can share their thoughts to others.
This series is mainly divided into two parts, assembly section and C language section.
This blog post is mainly about the assembly section.
Note: These two posts are all about 64-bit systems. Kernel Decompression Process
This process is not detailed, the entire Linux kernel as a compressed mirror provided, before the implementation of the kernel code, first need to bootloader it a decompression, this part is interested to see this blog. what is the original page table?
After the decompression is finished, a parse is performed on the elf format, then the kernel is loaded and the startup_64 is finally entered in the Arch/x86/kernel/head_64.s.
Startup_64 mainly completes the paging feature enabled, and finally jumps into the C code x86_64_start_kernel. Before we start parsing the code, let's take a look at what it looks like to initialize the page table in the data segment of the kernel.
1 2 3 4 5 6 7 8 9 10 11 12 13-14 15 16 17 18 19 20 21 22 23 The |
__initdata next_page (EARLY_LEVEL4_PGT). Fill 511,8,0. Quad Level3_k ERNEL_PGT-__start_kernel_map + _page_table next_page (early_dynamic_pgts). Fill 512*early_dynamic_page_tables,8,0. Data Next_page (INIT_LEVEL4_PGT). Fill 512,8,0 next_page (level3_kernel_pgt). Fill l3_start_kernel,8,0/* (2^48- 024*1024*1024)-((2^39) *511))/(2^30) = 510/. Quad LEVEL2_KERNEL_PGT-__start_kernel_map + _kernpg_table. Quad Level2 _FIXMAP_PGT-__start_kernel_map + _page_table next_page (LEVEL2_KERNEL_PGT) PMDs (0< |