Bläddra i källkod

Whoever put together the grub multiboot.h header is insane.

tags/v0.9.3
Michael Brown 18 år sedan
förälder
incheckning
ddbc60b5ae
1 ändrade filer med 146 tillägg och 135 borttagningar
  1. 146
    135
      src/arch/i386/include/multiboot.h

+ 146
- 135
src/arch/i386/include/multiboot.h Visa fil

@@ -1,136 +1,147 @@
1
-/* multiboot.h - the header for Multiboot */
2
-/* Copyright (C) 1999, 2001  Free Software Foundation, Inc.
3
-   
4
-   This program is free software; you can redistribute it and/or modify
5
-   it under the terms of the GNU General Public License as published by
6
-   the Free Software Foundation; either version 2 of the License, or
7
-   (at your option) any later version.
8
-   
9
-   This program is distributed in the hope that it will be useful,
10
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
11
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
-   GNU General Public License for more details.
13
-   
14
-   You should have received a copy of the GNU General Public License
15
-   along with this program; if not, write to the Free Software
16
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
17
-
18
-/* Macros.  */
19
-
20
-/* The magic number for the Multiboot header.  */
21
-#define MULTIBOOT_HEADER_MAGIC		0x1BADB002
22
-
23
-/* The flags for the Multiboot header.  */
24
-#ifdef __ELF__
25
-# define MULTIBOOT_HEADER_FLAGS		0x00000003
26
-#else
27
-# define MULTIBOOT_HEADER_FLAGS		0x00010003
28
-#endif
29
-
30
-/* The magic number passed by a Multiboot-compliant boot loader.  */
31
-#define MULTIBOOT_BOOTLOADER_MAGIC	0x2BADB002
32
-
33
-/* The size of our stack (16KB).  */
34
-#define STACK_SIZE			0x4000
35
-
36
-/* C symbol format. HAVE_ASM_USCORE is defined by configure.  */
37
-#ifdef HAVE_ASM_USCORE
38
-# define EXT_C(sym)			_ ## sym
39
-#else
40
-# define EXT_C(sym)			sym
41
-#endif
42
-
43
-#ifndef ASM
44
-/* Do not include here in boot.S.  */
45
-
46
-/* Types.  */
47
-
48
-/* The Multiboot header.  */
49
-typedef struct multiboot_header
50
-{
51
-  unsigned long magic;
52
-  unsigned long flags;
53
-  unsigned long checksum;
54
-  unsigned long header_addr;
55
-  unsigned long load_addr;
56
-  unsigned long load_end_addr;
57
-  unsigned long bss_end_addr;
58
-  unsigned long entry_addr;
59
-} multiboot_header_t;
60
-
61
-/* The symbol table for a.out.  */
62
-typedef struct multiboot_aout_symbol_table
63
-{
64
-  unsigned long tabsize;
65
-  unsigned long strsize;
66
-  unsigned long addr;
67
-  unsigned long reserved;
68
-} multiboot_aout_symbol_table_t;
69
-
70
-/* The section header table for ELF.  */
71
-typedef struct multiboot_elf_section_header_table
72
-{
73
-  unsigned long num;
74
-  unsigned long size;
75
-  unsigned long addr;
76
-  unsigned long shndx;
77
-} multiboot_elf_section_header_table_t;
78
-
79
-/* The Multiboot information.  */
80
-typedef struct multiboot_info
81
-{
82
-  unsigned long flags;
83
-  unsigned long mem_lower;
84
-  unsigned long mem_upper;
85
-  unsigned long boot_device;
86
-  unsigned long cmdline;
87
-  unsigned long mods_count;
88
-  unsigned long mods_addr;
89
-  union
90
-  {
91
-    multiboot_aout_symbol_table_t aout_sym;
92
-    multiboot_elf_section_header_table_t elf_sec;
93
-  } u;
94
-  unsigned long mmap_length;
95
-  unsigned long mmap_addr;
96
-  unsigned long drives_length;
97
-  unsigned long drives_addr;
98
-  unsigned long config_table;
99
-  unsigned long boot_loader_name;
100
-  unsigned long apm_table;
101
-  unsigned long vbe_control_info;
102
-  unsigned long vbe_mode_info;
103
-  unsigned short vbe_mode;
104
-  unsigned short vbe_interface_seg;
105
-  unsigned short vbe_interface_off;
106
-  unsigned short vbe_interface_len;
107
-} multiboot_info_t;
108
-
109
-/* The module structure.  */
110
-typedef struct multiboot_module
111
-{
112
-  unsigned long mod_start;
113
-  unsigned long mod_end;
114
-  unsigned long string;
115
-  unsigned long reserved;
116
-} multiboot_module_t;
117
-
118
-/* The memory map. Be careful that the offset 0 is base_addr_low
119
-   but no size.  */
120
-typedef struct multiboot_memory_map
121
-{
122
-  unsigned long size;
123
-  unsigned long base_addr_low;
124
-  unsigned long base_addr_high;
125
-  unsigned long length_low;
126
-  unsigned long length_high;
127
-  unsigned long type;
128
-} multiboot_memory_map_t;
129
-
130
-#endif /* ! ASM */
131
-
132
-/*
133
- * Local variables:
134
- *  c-basic-offset: 2
135
- * End:
1
+#ifndef _MULTIBOOT_H
2
+#define _MULTIBOOT_H
3
+
4
+/**
5
+ * @file
6
+ *
7
+ * Multiboot operating systems
8
+ *
136 9
  */
10
+
11
+#include <stdint.h>
12
+
13
+/** The magic number for the Multiboot header */
14
+#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
15
+
16
+/** Boot modules must be page aligned */
17
+#define MB_FLAG_PGALIGN 0x00000001
18
+
19
+/** Memory map must be provided */
20
+#define MB_FLAG_MEMMAP 0x00000002
21
+
22
+/** Video mode information must be provided */
23
+#define MB_FLAG_VIDMODE 0x00000004
24
+
25
+/** Image is a raw multiboot image (not ELF) */
26
+#define MB_FLAG_RAW 0x00010000
27
+
28
+/**
29
+ * The magic number passed by a Multiboot-compliant boot loader
30
+ *
31
+ * Must be passed in register %eax when jumping to the Multiboot OS
32
+ * image.
33
+ */
34
+#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
35
+
36
+/** Multiboot information structure mem_* fields are valid */
37
+#define MBI_FLAG_MEM 0x00000001
38
+
39
+/** Multiboot information structure boot_device field is valid */
40
+#define MBI_FLAG_BOOTDEV 0x00000002
41
+
42
+/** Multiboot information structure cmdline field is valid */
43
+#define MBI_FLAG_CMDLINE 0x00000004
44
+
45
+/** Multiboot information structure module fields are valid */
46
+#define MBI_FLAG_MODS 0x00000008
47
+
48
+/** Multiboot information structure a.out symbol table is valid */
49
+#define MBI_FLAG_AOUT 0x00000010
50
+
51
+/** Multiboot information struture ELF section header table is valid */
52
+#define MBI_FLAG_ELF 0x00000020
53
+
54
+/** Multiboot information structure memory map is valid */
55
+#define MBI_FLAG_MMAP 0x00000040
56
+
57
+/** Multiboot information structure drive list is valid */
58
+#define MBI_FLAG_DRIVES 0x00000080
59
+
60
+/** Multiboot information structure ROM configuration field is valid */
61
+#define MBI_FLAG_CFGTBL 0x00000100
62
+
63
+/** Multiboot information structure boot loader name field is valid */
64
+#define MBI_FLAG_LOADER 0x00000200
65
+
66
+/** Multiboot information structure APM table is valid */
67
+#define MBI_FLAG_APM 0x00000400
68
+
69
+/** Multiboot information structure video information is valid */
70
+#define MBI_FLAG_VBE 0x00000800
71
+
72
+/** A multiboot header */
73
+struct multiboot_header {
74
+	uint32_t magic;
75
+	uint32_t flags;
76
+	uint32_t checksum;
77
+	uint32_t header_addr;
78
+	uint32_t load_addr;
79
+	uint32_t load_end_addr;
80
+	uint32_t bss_end_addr;
81
+	uint32_t entry_addr;
82
+} __attribute__ (( packed, may_alias ));
83
+
84
+/** A multiboot a.out symbol table */
85
+struct multiboot_aout_symbol_table {
86
+	uint32_t tabsize;
87
+	uint32_t strsize;
88
+	uint32_t addr;
89
+	uint32_t reserved;
90
+} __attribute__ (( packed, may_alias ));
91
+
92
+/** A multiboot ELF section header table */
93
+struct multiboot_elf_section_header_table {
94
+	uint32_t num;
95
+	uint32_t size;
96
+	uint32_t addr;
97
+	uint32_t shndx;
98
+} __attribute__ (( packed, may_alias ));
99
+
100
+/** A multiboot information structure */
101
+struct multiboot_info {
102
+	uint32_t flags;
103
+	uint32_t mem_lower;
104
+	uint32_t mem_upper;
105
+	uint32_t boot_device;
106
+	uint32_t cmdline;
107
+	uint32_t mods_count;
108
+	uint32_t mods_addr;
109
+	union {
110
+		struct multiboot_aout_symbol_table aout_syms;
111
+		struct multiboot_elf_section_header_table elf_sections;
112
+	} syms;
113
+	uint32_t mmap_length;
114
+	uint32_t mmap_addr;
115
+	uint32_t drives_length;
116
+	uint32_t drives_addr;
117
+	uint32_t config_table;
118
+	uint32_t boot_loader_name;
119
+	uint32_t apm_table;
120
+	uint32_t vbe_control_info;
121
+	uint32_t vbe_mode_info;
122
+	uint16_t vbe_mode;
123
+	uint16_t vbe_interface_seg;
124
+	uint16_t vbe_interface_off;
125
+	uint16_t vbe_interface_len;
126
+} __attribute__ (( packed, may_alias ));
127
+
128
+/** A multiboot module structure */
129
+struct multiboot_module {
130
+	uint32_t mod_start;
131
+	uint32_t mod_end;
132
+	uint32_t string;
133
+	uint32_t reserved;
134
+} __attribute__ (( packed, may_alias ));
135
+
136
+/** A multiboot memory map entry */
137
+struct multiboot_memory_map {
138
+	uint32_t size;
139
+	uint64_t base_addr;
140
+	uint64_t length;
141
+	uint32_t type;
142
+} __attribute__ (( packed, may_alias ));
143
+
144
+/** Usable RAM */
145
+#define MBMEM_RAM 1
146
+
147
+#endif /* _MULTIBOOT_H */

Laddar…
Avbryt
Spara