@@ -35,4 +35,58 @@ be used to fill boot parameters, vmm is totally responsible for the construction
35
35
36
36
- GDT must be configured and loaded
37
37
38
+ # bzImage
39
+
40
+ The boot process is also explained from the following two sides.
41
+
42
+ ## Loader side
43
+
44
+ ### What will be returned from loader
45
+
46
+ bzImage includes two parts, the setup and the compressed kernel. The compressed
47
+ kernel part will be loaded into guest memory, and the following three parts
48
+ will be returned to the VMM by the loader.
49
+
50
+ - The start address of loaded kernel
51
+
52
+ - The offset of memory where kernel is end of loading
53
+
54
+ - The setup header begin at the offset 0x01f1 of bzImage, this one is an extra
55
+ compared to the return of ELF loader.
56
+
57
+ ### Where kernel is loaded
58
+
59
+ The same as ELF image loader, there are two ways for deciding where the
60
+ compressed kernel will be loaded.
61
+
62
+ - VMM specify where to load kernel image.
63
+
64
+ - Load into code32_start (Boot load address) by default.
65
+
66
+ ### Additional checking
67
+
68
+ As what the boot protocol said, the kernel is a bzImage kernel if the
69
+ protocol >= 2.00 and the 0x01 bit(LOAD_HIGH) is the loadflags field is set. Add
70
+ this checking to validate the bzImage.
71
+
72
+ ## VMM side
73
+
74
+ ### Construct zero page
75
+
76
+ While vmm build "zero page" with e820 table and other stuff, bzImage loader will
77
+ return the setup header to fill the boot parameters. Meanwhile,
78
+ setup_header.init_size is a must to be filled into zero page, which will be used
79
+ during head_64.S boot process.
80
+
81
+ ### Configure vCPU
82
+
83
+ - RIP, the start address of loaded 64-bit kernel returned from loader + 0x200.
84
+ Regarding to the 64-bit boot protocol, kernel is started by jumping to the
85
+ 64-bit kernel entry point, which is the start address of loaded 64-bit kernel
86
+ plus 0x200.
87
+
88
+ - 64 bit mode with paging enabled
89
+
90
+ - GDT must be configured and loaded
91
+
38
92
0 commit comments