Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / arch / i386 / include / bzimage.h
1 #ifndef _BZIMAGE_H
2 #define _BZIMAGE_H
3
4 FILE_LICENCE ( GPL2_OR_LATER );
5
6 #include <stdint.h>
7
8 /**
9  * A bzImage header
10  *
11  * As documented in Documentation/i386/boot.txt
12  */
13 struct bzimage_header {
14         /** The size of the setup in sectors
15          *
16          * If this field contains 0, assume it contains 4.
17          */
18         uint8_t setup_sects;
19         /** If set, the root is mounted readonly */
20         uint16_t root_flags;
21         /** DO NOT USE - for bootsect.S use only */
22         uint16_t syssize;
23         /** DO NOT USE - obsolete */
24         uint16_t swap_dev;
25         /** DO NOT USE - for bootsect.S use only */
26         uint16_t ram_size;
27         /** Video mode control */
28         uint16_t vid_mode;
29         /** Default root device number */
30         uint16_t root_dev;
31         /** 0xAA55 magic number */
32         uint16_t boot_flag;
33         /** Jump instruction */
34         uint16_t jump;
35         /** Magic signature "HdrS" */
36         uint32_t header;
37         /** Boot protocol version supported */
38         uint16_t version;
39         /** Boot loader hook (see below) */
40         uint32_t realmode_swtch;
41         /** The load-low segment (0x1000) (obsolete) */
42         uint16_t start_sys;
43         /** Pointer to kernel version string */
44         uint16_t kernel_version;
45         /** Boot loader identifier */
46         uint8_t type_of_loader;
47         /** Boot protocol option flags */
48         uint8_t loadflags;
49         /** Move to high memory size (used with hooks) */
50         uint16_t setup_move_size;
51         /** Boot loader hook (see below) */
52         uint32_t code32_start;
53         /** initrd load address (set by boot loader) */
54         uint32_t ramdisk_image;
55         /** initrd size (set by boot loader) */
56         uint32_t ramdisk_size;
57         /** DO NOT USE - for bootsect.S use only */
58         uint32_t bootsect_kludge;
59         /** Free memory after setup end */
60         uint16_t heap_end_ptr;
61         /** Unused */
62         uint16_t pad1;
63         /** 32-bit pointer to the kernel command line */
64         uint32_t cmd_line_ptr;
65         /** Highest legal initrd address */
66         uint32_t initrd_addr_max;
67         /** Physical addr alignment required for kernel */
68         uint32_t kernel_alignment;
69         /** Whether kernel is relocatable or not */
70         uint8_t relocatable_kernel;
71         /** Unused */
72         uint8_t pad2[3];
73         /** Maximum size of the kernel command line */
74         uint32_t cmdline_size;
75 } __attribute__ (( packed ));
76
77 /** Offset of bzImage header within kernel image */
78 #define BZI_HDR_OFFSET 0x1f1
79
80 /** bzImage boot flag value */
81 #define BZI_BOOT_FLAG 0xaa55
82
83 /** bzImage magic signature value */
84 #define BZI_SIGNATURE 0x53726448
85
86 /** bzImage boot loader identifier for Etherboot */
87 #define BZI_LOADER_TYPE_ETHERBOOT 0x40
88
89 /** bzImage boot loader identifier for iPXE
90  *
91  * We advertise ourselves as Etherboot version 6.
92  */
93 #define BZI_LOADER_TYPE_IPXE ( BZI_LOADER_TYPE_ETHERBOOT | 0x06 )
94
95 /** bzImage "load high" flag */
96 #define BZI_LOAD_HIGH 0x01
97
98 /** Load address for high-loaded kernels */
99 #define BZI_LOAD_HIGH_ADDR 0x100000
100
101 /** Load address for low-loaded kernels */
102 #define BZI_LOAD_LOW_ADDR 0x10000
103
104 /** bzImage "kernel can use heap" flag */
105 #define BZI_CAN_USE_HEAP 0x80
106
107 /** bzImage special video mode "normal" */
108 #define BZI_VID_MODE_NORMAL 0xffff
109
110 /** bzImage special video mode "ext" */
111 #define BZI_VID_MODE_EXT 0xfffe
112
113 /** bzImage special video mode "ask" */
114 #define BZI_VID_MODE_ASK 0xfffd
115
116 /** bzImage maximum initrd address for versions < 2.03 */
117 #define BZI_INITRD_MAX 0x37ffffff
118
119 /** bzImage command-line structure used by older kernels */
120 struct bzimage_cmdline {
121         /** Magic signature */
122         uint16_t magic;
123         /** Offset to command line */
124         uint16_t offset;
125 } __attribute__ (( packed ));
126
127 /** Offset of bzImage command-line structure within kernel image */
128 #define BZI_CMDLINE_OFFSET 0x20
129
130 /** bzImage command line present magic marker value */
131 #define BZI_CMDLINE_MAGIC 0xa33f
132
133 /** Assumed size of real-mode portion (including .bss) */
134 #define BZI_ASSUMED_RM_SIZE 0x8000
135
136 /** Amount of stack space to provide */
137 #define BZI_STACK_SIZE 0x1000
138
139 /** Maximum size of command line */
140 #define BZI_CMDLINE_SIZE 0x7ff
141
142 #endif /* _BZIMAGE_H */