1 /* 2 * Copyright (c) 2006-2021, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2006-10-09 Bernard the grub related definitions 9 * (multiboot) 10 */ 11 12 #ifndef __GRUB_H__ 13 #define __GRUB_H__ 14 15 /* the magic number for the multiboot header. */ 16 #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 17 18 /* the flags for the multiboot header. */ 19 #define MULTIBOOT_HEADER_FLAGS 0x00000003 20 21 /* the magic number passed by a multiboot-compliant boot loader. */ 22 #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 23 24 #ifndef __ASM__ 25 /* the multiboot header. */ 26 typedef struct multiboot_header 27 { 28 unsigned long magic; 29 unsigned long flags; 30 unsigned long checksum; 31 unsigned long header_addr; 32 unsigned long load_addr; 33 unsigned long load_end_addr; 34 unsigned long bss_end_addr; 35 unsigned long entry_addr; 36 } multiboot_header_t; 37 38 /* the section header table for elf. */ 39 typedef struct elf_section_header_table 40 { 41 unsigned long num; 42 unsigned long size; 43 unsigned long addr; 44 unsigned long shndx; 45 } elf_section_header_table_t; 46 47 /* the multiboot information. */ 48 typedef struct multiboot_info 49 { 50 unsigned long flags; 51 unsigned long mem_lower; 52 unsigned long mem_upper; 53 unsigned long boot_device; 54 unsigned long cmdline; 55 unsigned long mods_count; 56 unsigned long mods_addr; 57 union 58 { 59 aout_symbol_table_t aout_sym; 60 elf_section_header_table_t elf_sec; 61 } u; 62 unsigned long mmap_length; 63 unsigned long mmap_addr; 64 } multiboot_info_t; 65 66 /* the module structure. */ 67 typedef struct module 68 { 69 unsigned long mod_start; 70 unsigned long mod_end; 71 unsigned long string; 72 unsigned long reserved; 73 } module_t; 74 75 /* the memory map. be careful that the offset 0 is base_addr_low 76 but no size. */ 77 typedef struct memory_map 78 { 79 unsigned long size; 80 unsigned long base_addr_low; 81 unsigned long base_addr_high; 82 unsigned long length_low; 83 unsigned long length_high; 84 unsigned long type; 85 } memory_map_t; 86 87 #endif 88 89 #endif 90