]> git.proxmox.com Git - grub2.git/blob - include/grub/i386/linux.h
2007-07-22 Yoshinori K. Okuji <okuji@enbug.org>
[grub2.git] / include / grub / i386 / linux.h
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 1999,2000,2001,2002,2003,2004,2007 Free Software Foundation, Inc.
4 *
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef GRUB_LINUX_MACHINE_HEADER
20 #define GRUB_LINUX_MACHINE_HEADER 1
21
22 #define GRUB_LINUX_MAGIC_SIGNATURE 0x53726448 /* "HdrS" */
23 #define GRUB_LINUX_DEFAULT_SETUP_SECTS 4
24 #define GRUB_LINUX_FLAG_CAN_USE_HEAP 0x80
25 #define GRUB_LINUX_INITRD_MAX_ADDRESS 0x37FFFFFF
26 #define GRUB_LINUX_MAX_SETUP_SECTS 64
27 #define GRUB_LINUX_BOOT_LOADER_TYPE 0x72
28 #define GRUB_LINUX_HEAP_END_OFFSET (0x9000 - 0x200)
29
30 #define GRUB_LINUX_BZIMAGE_ADDR 0x100000
31 #define GRUB_LINUX_ZIMAGE_ADDR 0x10000
32 #define GRUB_LINUX_OLD_REAL_MODE_ADDR 0x90000
33 #define GRUB_LINUX_SETUP_STACK 0x9000
34
35 #define GRUB_LINUX_FLAG_BIG_KERNEL 0x1
36
37 /* Linux's video mode selection support. Actually I hate it! */
38 #define GRUB_LINUX_VID_MODE_NORMAL 0xFFFF
39 #define GRUB_LINUX_VID_MODE_EXTENDED 0xFFFE
40 #define GRUB_LINUX_VID_MODE_ASK 0xFFFD
41
42 #define GRUB_LINUX_CL_OFFSET 0x9000
43 #define GRUB_LINUX_CL_END_OFFSET 0x90FF
44 #define GRUB_LINUX_SETUP_MOVE_SIZE 0x9100
45 #define GRUB_LINUX_CL_MAGIC 0xA33F
46
47 #define GRUB_LINUX_EFI_SIGNATURE \
48 ('E' << 24 | 'F' << 16 | 'I' << 8 | 'L')
49
50 #ifndef ASM_FILE
51
52 /* For the Linux/i386 boot protocol version 2.03. */
53 struct linux_kernel_header
54 {
55 grub_uint8_t code1[0x0020];
56 grub_uint16_t cl_magic; /* Magic number 0xA33F */
57 grub_uint16_t cl_offset; /* The offset of command line */
58 grub_uint8_t code2[0x01F1 - 0x0020 - 2 - 2];
59 grub_uint8_t setup_sects; /* The size of the setup in sectors */
60 grub_uint16_t root_flags; /* If the root is mounted readonly */
61 grub_uint16_t syssize; /* obsolete */
62 grub_uint16_t swap_dev; /* obsolete */
63 grub_uint16_t ram_size; /* obsolete */
64 grub_uint16_t vid_mode; /* Video mode control */
65 grub_uint16_t root_dev; /* Default root device number */
66 grub_uint16_t boot_flag; /* 0xAA55 magic number */
67 grub_uint16_t jump; /* Jump instruction */
68 grub_uint32_t header; /* Magic signature "HdrS" */
69 grub_uint16_t version; /* Boot protocol version supported */
70 grub_uint32_t realmode_swtch; /* Boot loader hook */
71 grub_uint16_t start_sys; /* The load-low segment (obsolete) */
72 grub_uint16_t kernel_version; /* Points to kernel version string */
73 grub_uint8_t type_of_loader; /* Boot loader identifier */
74 grub_uint8_t loadflags; /* Boot protocol option flags */
75 grub_uint16_t setup_move_size; /* Move to high memory size */
76 grub_uint32_t code32_start; /* Boot loader hook */
77 grub_uint32_t ramdisk_image; /* initrd load address */
78 grub_uint32_t ramdisk_size; /* initrd size */
79 grub_uint32_t bootsect_kludge; /* obsolete */
80 grub_uint16_t heap_end_ptr; /* Free memory after setup end */
81 grub_uint16_t pad1; /* Unused */
82 char *cmd_line_ptr; /* Points to the kernel command line */
83 grub_uint32_t initrd_addr_max; /* Highest address for initrd */
84 } __attribute__ ((packed));
85
86 /* Boot parameters for Linux based on 2.6.12. This is used by the setup
87 sectors of Linux, and must be simulated by GRUB on EFI, because
88 the setup sectors depend on BIOS. */
89 struct linux_kernel_params
90 {
91 grub_uint8_t video_cursor_x; /* 0 */
92 grub_uint8_t video_cursor_y;
93
94 grub_uint16_t ext_mem; /* 2 */
95
96 grub_uint16_t video_page; /* 4 */
97 grub_uint8_t video_mode; /* 6 */
98 grub_uint8_t video_width; /* 7 */
99
100 grub_uint8_t padding1[0xa - 0x8];
101
102 grub_uint16_t video_ega_bx; /* a */
103
104 grub_uint8_t padding2[0xe - 0xc];
105
106 grub_uint8_t video_height; /* e */
107 grub_uint8_t have_vga; /* f */
108 grub_uint16_t font_size; /* 10 */
109
110 grub_uint16_t lfb_width; /* 12 */
111 grub_uint16_t lfb_height; /* 14 */
112 grub_uint16_t lfb_depth; /* 16 */
113 grub_uint32_t lfb_base; /* 18 */
114 grub_uint32_t lfb_size; /* 1c */
115
116 grub_uint16_t cl_magic; /* 20 */
117 grub_uint16_t cl_offset;
118
119 grub_uint16_t lfb_line_len; /* 24 */
120 grub_uint8_t red_mask_size; /* 26 */
121 grub_uint8_t red_field_pos;
122 grub_uint8_t green_mask_size;
123 grub_uint8_t green_field_pos;
124 grub_uint8_t blue_mask_size;
125 grub_uint8_t blue_field_pos;
126 grub_uint8_t reserved_mask_size;
127 grub_uint8_t reserved_field_pos;
128 grub_uint16_t vesapm_segment; /* 2e */
129 grub_uint16_t vesapm_offset; /* 30 */
130 grub_uint16_t lfb_pages; /* 32 */
131 grub_uint16_t vesa_attrib; /* 34 */
132
133 grub_uint8_t padding3[0x40 - 0x36];
134
135 grub_uint16_t apm_version; /* 40 */
136 grub_uint16_t apm_code_segment; /* 42 */
137 grub_uint32_t apm_entry; /* 44 */
138 grub_uint16_t apm_16bit_code_segment; /* 48 */
139 grub_uint16_t apm_data_segment; /* 4a */
140 grub_uint16_t apm_flags; /* 4c */
141 grub_uint32_t apm_code_len; /* 4e */
142 grub_uint16_t apm_data_len; /* 52 */
143
144 grub_uint8_t padding4[0x60 - 0x54];
145
146 grub_uint32_t ist_signature; /* 60 */
147 grub_uint32_t ist_command; /* 64 */
148 grub_uint32_t ist_event; /* 68 */
149 grub_uint32_t ist_perf_level; /* 6c */
150
151 grub_uint8_t padding5[0x80 - 0x70];
152
153 grub_uint8_t hd0_drive_info[0x10]; /* 80 */
154 grub_uint8_t hd1_drive_info[0x10]; /* 90 */
155 grub_uint16_t rom_config_len; /* a0 */
156
157 grub_uint8_t padding6[0x1c0 - 0xa2];
158
159 grub_uint32_t efi_signature; /* 1c0 */
160 grub_uint32_t efi_system_table; /* 1c4 */
161 grub_uint32_t efi_mem_desc_size; /* 1c8 */
162 grub_uint32_t efi_mem_desc_version; /* 1cc */
163 grub_uint32_t efi_mmap; /* 1d0 */
164 grub_uint32_t efi_mmap_size; /* 1d4 */
165
166 grub_uint8_t padding7[0x1e0 - 0x1d8];
167
168 grub_uint32_t alt_mem; /* 1e0 */
169
170 grub_uint8_t padding8[0x1e8 - 0x1e4];
171
172 grub_uint32_t mmap_size; /* 1e8 */
173
174 grub_uint8_t padding9[0x1ff - 0x1ec];
175
176 grub_uint8_t ps_mouse; /* 1ff */
177 } __attribute__ ((packed));
178 #endif /* ! ASM_FILE */
179
180 #endif /* ! GRUB_LINUX_MACHINE_HEADER */