#ifndef __HOS_MULTIBOOT_H__ #define __HOS_MULTIBOOT_H__ __HOS_MULTIBOOT_H__ #include "hos_defines.h" /* The magic number for the Multiboot header. */ #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 #define MB_HEADER_ALIGN_MODULES 0x01 #define MB_HEADER_MEM_INFO 0x02 #define MB_HEADER_VIDEO_INFO 0x04 #define MB_HEADER_KLUDGE_OFFSETS 0x10000 /* The magic number passed by a Multiboot-compliant boot loader. */ #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 #define MB_BOOTLOADER_MEM_INFO 0x01 #define MB_BOOTLOADER_BOOT_DEVICE 0x02 #define MB_BOOTLOADER_COMMAND_LINE 0x04 #define MB_BOOTLOADER_MODS 0x08 #define MB_BOOTLOADER_AOUT 0x10 #define MB_BOOTLOADER_ELF 0x20 #define MB_BOOTLOADER_MMAP 0x40 #define MB_BOOTLOADER_DRIVES 0x80 #define MB_BOOTLOADER_CONFIG 0x0100 #define MB_BOOTLOADER_APM 0x0200 #define MB_BOOTLOADER_GRAPHICS 0x0400 #define MB_DRIVE_MODE_CHS 0 #define MB_DRIVE_MODE_LBA 1 /* The Multiboot header. */ typedef struct { unsigned int magic; unsigned int flags; unsigned int checksum; unsigned int header_addr; unsigned int load_addr; unsigned int load_end_addr; unsigned int bss_end_addr; unsigned int entry_addr; } mb_header_t; /* The symbol table for a.out. */ typedef struct { unsigned int tabsize; unsigned int strsize; unsigned int addr; unsigned int reserved; } mb_aout_symbol_table_t; /* The section header table for ELF. */ typedef struct { unsigned int num; unsigned int size; unsigned int addr; unsigned int shndx; } mb_elf_section_header_table_t; /* The Multiboot information. */ typedef struct { unsigned int flags; unsigned int mem_lower; // present if flags[0] is set unsigned int mem_upper; unsigned int boot_device; // 1 unsigned int cmdline; // 2 unsigned int mods_count; // 3 unsigned int mods_addr; union { mb_aout_symbol_table_t aout_sym; // 4 mb_elf_section_header_table_t elf_sec; // 5 }; unsigned int mmap_length; // 6 unsigned int mmap_addr; unsigned int drives_length; // 7 unsigned int drives_addr; unsigned int config_table; // 8 unsigned int bootloader_name; // 9 unsigned int apm_table; // 10 unsigned int vbe_control_info; // 11 unsigned int vbe_mode_info; unsigned short vbe_mode; unsigned short vbe_interface_seg; unsigned short vbe_interface_off; unsigned short vbe_interface_len; } mb_info_t; /* The module structure. */ typedef struct { unsigned int mod_start; unsigned int mod_end; unsigned int string; unsigned int reserved; } mb_module_t; /* The memory map. Be careful that the offset 0 is base_addr_low, not size. */ typedef struct { unsigned int size; //offset -4 // unsigned int base_addr_low; //offset 0 // unsigned int base_addr_high; // unsigned int length_low; // unsigned int length_high; u64_t base; u64_t length; unsigned int type; } mb_mmap_t; /* The drive structure */ typedef struct { unsigned int size; unsigned char drive_number; unsigned char drive_mode; unsigned char drive_cylinders; unsigned char drive_heads; unsigned char drive_sectors; unsigned short drive_ports[1]; } mb_drive_t; /* APM table structure */ typedef struct { unsigned short version; unsigned short cseg; unsigned int offset; unsigned short cseg_16; unsigned short dseg; unsigned short flags; unsigned short cseg_len; unsigned short cseg_16_len; unsigned short dseg_len; } mb_apm_t; #endif