| 1 | /* multiboot.h - the header for Multiboot */ |
|---|
| 2 | /* copied into libcaca in 2010 by sam@hocevar.net */ |
|---|
| 3 | /* Copyright (C) 1999 Free Software Foundation, Inc. |
|---|
| 4 | |
|---|
| 5 | This program is free software; you can redistribute it and/or modify |
|---|
| 6 | it under the terms of the GNU General Public License as published by |
|---|
| 7 | the Free Software Foundation; either version 2 of the License, or |
|---|
| 8 | (at your option) any later version. |
|---|
| 9 | |
|---|
| 10 | This program is distributed in the hope that it will be useful, |
|---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | GNU General Public License for more details. |
|---|
| 14 | |
|---|
| 15 | You should have received a copy of the GNU General Public License |
|---|
| 16 | along with this program; if not, write to the Free Software |
|---|
| 17 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
|---|
| 18 | |
|---|
| 19 | /* Macros. */ |
|---|
| 20 | |
|---|
| 21 | /* The magic number for the Multiboot header. */ |
|---|
| 22 | #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 |
|---|
| 23 | |
|---|
| 24 | /* The flags for the Multiboot header. */ |
|---|
| 25 | #define MULTIBOOT_HEADER_FLAGS 0x00010003 |
|---|
| 26 | |
|---|
| 27 | /* The magic number passed by a Multiboot-compliant boot loader. */ |
|---|
| 28 | #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 |
|---|
| 29 | |
|---|
| 30 | /* The size of our stack (16KB). */ |
|---|
| 31 | #define STACK_SIZE 0x4000 |
|---|
| 32 | |
|---|
| 33 | /* C symbol format. HAVE_ASM_USCORE is defined by configure. */ |
|---|
| 34 | #ifdef HAVE_ASM_USCORE |
|---|
| 35 | # define EXT_C(sym) _ ## sym |
|---|
| 36 | #else |
|---|
| 37 | # define EXT_C(sym) sym |
|---|
| 38 | #endif |
|---|
| 39 | |
|---|
| 40 | #ifndef ASM |
|---|
| 41 | /* Do not include here in boot.S. */ |
|---|
| 42 | |
|---|
| 43 | /* Types. */ |
|---|
| 44 | |
|---|
| 45 | /* The Multiboot header. */ |
|---|
| 46 | typedef struct multiboot_header |
|---|
| 47 | { |
|---|
| 48 | unsigned long magic; |
|---|
| 49 | unsigned long flags; |
|---|
| 50 | unsigned long checksum; |
|---|
| 51 | unsigned long header_addr; |
|---|
| 52 | unsigned long load_addr; |
|---|
| 53 | unsigned long load_end_addr; |
|---|
| 54 | unsigned long bss_end_addr; |
|---|
| 55 | unsigned long entry_addr; |
|---|
| 56 | } multiboot_header_t; |
|---|
| 57 | |
|---|
| 58 | /* The symbol table for a.out. */ |
|---|
| 59 | typedef struct aout_symbol_table |
|---|
| 60 | { |
|---|
| 61 | unsigned long tabsize; |
|---|
| 62 | unsigned long strsize; |
|---|
| 63 | unsigned long addr; |
|---|
| 64 | unsigned long reserved; |
|---|
| 65 | } aout_symbol_table_t; |
|---|
| 66 | |
|---|
| 67 | /* The section header table for ELF. */ |
|---|
| 68 | typedef struct elf_section_header_table |
|---|
| 69 | { |
|---|
| 70 | unsigned long num; |
|---|
| 71 | unsigned long size; |
|---|
| 72 | unsigned long addr; |
|---|
| 73 | unsigned long shndx; |
|---|
| 74 | } elf_section_header_table_t; |
|---|
| 75 | |
|---|
| 76 | /* The Multiboot information. */ |
|---|
| 77 | typedef struct multiboot_info |
|---|
| 78 | { |
|---|
| 79 | unsigned long flags; |
|---|
| 80 | unsigned long mem_lower; |
|---|
| 81 | unsigned long mem_upper; |
|---|
| 82 | unsigned long boot_device; |
|---|
| 83 | unsigned long cmdline; |
|---|
| 84 | unsigned long mods_count; |
|---|
| 85 | unsigned long mods_addr; |
|---|
| 86 | union |
|---|
| 87 | { |
|---|
| 88 | aout_symbol_table_t aout_sym; |
|---|
| 89 | elf_section_header_table_t elf_sec; |
|---|
| 90 | } u; |
|---|
| 91 | unsigned long mmap_length; |
|---|
| 92 | unsigned long mmap_addr; |
|---|
| 93 | } multiboot_info_t; |
|---|
| 94 | |
|---|
| 95 | /* The module structure. */ |
|---|
| 96 | typedef struct module |
|---|
| 97 | { |
|---|
| 98 | unsigned long mod_start; |
|---|
| 99 | unsigned long mod_end; |
|---|
| 100 | unsigned long string; |
|---|
| 101 | unsigned long reserved; |
|---|
| 102 | } module_t; |
|---|
| 103 | |
|---|
| 104 | /* The memory map. Be careful that the offset 0 is base_addr_low |
|---|
| 105 | but no size. */ |
|---|
| 106 | typedef struct memory_map |
|---|
| 107 | { |
|---|
| 108 | unsigned long size; |
|---|
| 109 | unsigned long base_addr_low; |
|---|
| 110 | unsigned long base_addr_high; |
|---|
| 111 | unsigned long length_low; |
|---|
| 112 | unsigned long length_high; |
|---|
| 113 | unsigned long type; |
|---|
| 114 | } memory_map_t; |
|---|
| 115 | |
|---|
| 116 | #endif /* ! ASM */ |
|---|