2009-11-21 Samuel Thibault <samuel.thibault@ens-lyon.org>
[grub2.git] / include / multiboot2.h
blobc87c3d175f986cbe85e374958101273df0930191
1 /* multiboot2.h - multiboot 2 header file. */
2 /*
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2007 Free Software Foundation, Inc.
6 * GRUB is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * GRUB is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef MULTIBOOT2_HEADER
21 #define MULTIBOOT2_HEADER 1
23 /* How many bytes from the start of the file we search for the header. */
24 #define MULTIBOOT2_HEADER_SEARCH 8192
26 /* The magic field should contain this. */
27 #define MULTIBOOT2_HEADER_MAGIC 0xe85250d6
29 /* Passed from the bootloader to the kernel. */
30 #define MULTIBOOT2_BOOTLOADER_MAGIC 0x36d76289
32 /* Alignment of multiboot modules. */
33 #define MULTIBOOT2_MOD_ALIGN 0x00001000
35 #ifndef ASM_FILE
37 #ifndef __WORDSIZE
38 #include <stdint.h>
39 #endif
41 /* XXX not portable? */
42 #if __WORDSIZE == 64
43 typedef uint64_t multiboot_word;
44 #else
45 typedef uint32_t multiboot_word;
46 #endif
48 struct multiboot_header
50 uint32_t magic;
51 uint32_t flags;
54 struct multiboot_tag_header
56 uint32_t key;
57 uint32_t len;
60 #define MULTIBOOT2_TAG_RESERVED1 0
61 #define MULTIBOOT2_TAG_RESERVED2 (~0)
63 #define MULTIBOOT2_TAG_START 1
64 struct multiboot_tag_start
66 struct multiboot_tag_header header;
67 multiboot_word size; /* Total size of all multiboot tags. */
70 #define MULTIBOOT2_TAG_NAME 2
71 struct multiboot_tag_name
73 struct multiboot_tag_header header;
74 char name[1];
77 #define MULTIBOOT2_TAG_MODULE 3
78 struct multiboot_tag_module
80 struct multiboot_tag_header header;
81 multiboot_word addr;
82 multiboot_word size;
83 char type[36];
84 char cmdline[1];
87 #define MULTIBOOT2_TAG_MEMORY 4
88 struct multiboot_tag_memory
90 struct multiboot_tag_header header;
91 multiboot_word addr;
92 multiboot_word size;
93 multiboot_word type;
96 #define MULTIBOOT2_TAG_UNUSED 5
97 struct multiboot_tag_unused
99 struct multiboot_tag_header header;
102 #define MULTIBOOT2_TAG_END 0xffff
103 struct multiboot_tag_end
105 struct multiboot_tag_header header;
108 #endif /* ! ASM_FILE */
110 #endif /* ! MULTIBOOT2_HEADER */