001 #ifndef __MULTIBOOT_H__
002 #define __MULTIBOOT_H__
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024 #define MULTIBOOT_HEADER_MAGIC 0x1BADB002
025
026
027 #define MULTIBOOT_HEADER_FLAGS 0x00010003
028
029
030 #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
031
032
033 #define MULTIBOOT_STACK_SIZE 0x4000
034
035 #define MULTIBOOT_CMDLINE 4
036 #define MULTIBOOT_MODS 8
037
038
039 #ifdef HAVE_ASM_USCORE
040 # define EXT_C(sym) _ ## sym
041 #else
042 # define EXT_C(sym) sym
043 #endif
044
045 #ifndef ASM
046
047
048 #include <sos/types.h>
049
050
051
052 extern sos_vaddr_t bootstrap_stack_bottom;
053 extern sos_size_t bootstrap_stack_size;
054
055
056
057
058
059 typedef struct multiboot_header
060 {
061 unsigned long magic;
062 unsigned long flags;
063 unsigned long checksum;
064 unsigned long header_addr;
065 unsigned long load_addr;
066 unsigned long load_end_addr;
067 unsigned long bss_end_addr;
068 unsigned long entry_addr;
069 } multiboot_header_t;
070
071
072 typedef struct aout_symbol_table
073 {
074 unsigned long tabsize;
075 unsigned long strsize;
076 unsigned long addr;
077 unsigned long reserved;
078 } aout_symbol_table_t;
079
080
081 typedef struct elf_section_header_table
082 {
083 unsigned long num;
084 unsigned long size;
085 unsigned long addr;
086 unsigned long shndx;
087 } elf_section_header_table_t;
088
089
090 typedef struct multiboot_info
091 {
092 unsigned long flags;
093 unsigned long mem_lower;
094 unsigned long mem_upper;
095 unsigned long boot_device;
096 unsigned long cmdline;
097 unsigned long mods_count;
098 unsigned long mods_addr;
099 union
100 {
101 aout_symbol_table_t aout_sym;
102 elf_section_header_table_t elf_sec;
103 } u;
104 unsigned long mmap_length;
105 unsigned long mmap_addr;
106 unsigned long drives_length;
107 unsigned long drives_addr;
108 } multiboot_info_t;
109
110
111 typedef struct module
112 {
113 unsigned long mod_start;
114 unsigned long mod_end;
115 unsigned long string;
116 unsigned long reserved;
117 } module_t;
118
119
120
121 typedef struct memory_map
122 {
123 unsigned long size;
124 unsigned long base_addr_low;
125 unsigned long base_addr_high;
126 unsigned long length_low;
127 unsigned long length_high;
128 unsigned long type;
129 } memory_map_t;
130
131 void dump_multiboot_info(multiboot_info_t *mbi);
132
133 #endif
134
135 #endif