You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

multiboot.h 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. #ifndef _MULTIBOOT_H
  2. #define _MULTIBOOT_H
  3. /**
  4. * @file
  5. *
  6. * Multiboot operating systems
  7. *
  8. */
  9. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  10. #include <stdint.h>
  11. /** The magic number for the Multiboot header */
  12. #define MULTIBOOT_HEADER_MAGIC 0x1BADB002
  13. /** Boot modules must be page aligned */
  14. #define MB_FLAG_PGALIGN 0x00000001
  15. /** Memory map must be provided */
  16. #define MB_FLAG_MEMMAP 0x00000002
  17. /** Video mode information must be provided */
  18. #define MB_FLAG_VIDMODE 0x00000004
  19. /** Image is a raw multiboot image (not ELF) */
  20. #define MB_FLAG_RAW 0x00010000
  21. /**
  22. * The magic number passed by a Multiboot-compliant boot loader
  23. *
  24. * Must be passed in register %eax when jumping to the Multiboot OS
  25. * image.
  26. */
  27. #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
  28. /** Multiboot information structure mem_* fields are valid */
  29. #define MBI_FLAG_MEM 0x00000001
  30. /** Multiboot information structure boot_device field is valid */
  31. #define MBI_FLAG_BOOTDEV 0x00000002
  32. /** Multiboot information structure cmdline field is valid */
  33. #define MBI_FLAG_CMDLINE 0x00000004
  34. /** Multiboot information structure module fields are valid */
  35. #define MBI_FLAG_MODS 0x00000008
  36. /** Multiboot information structure a.out symbol table is valid */
  37. #define MBI_FLAG_AOUT 0x00000010
  38. /** Multiboot information struture ELF section header table is valid */
  39. #define MBI_FLAG_ELF 0x00000020
  40. /** Multiboot information structure memory map is valid */
  41. #define MBI_FLAG_MMAP 0x00000040
  42. /** Multiboot information structure drive list is valid */
  43. #define MBI_FLAG_DRIVES 0x00000080
  44. /** Multiboot information structure ROM configuration field is valid */
  45. #define MBI_FLAG_CFGTBL 0x00000100
  46. /** Multiboot information structure boot loader name field is valid */
  47. #define MBI_FLAG_LOADER 0x00000200
  48. /** Multiboot information structure APM table is valid */
  49. #define MBI_FLAG_APM 0x00000400
  50. /** Multiboot information structure video information is valid */
  51. #define MBI_FLAG_VBE 0x00000800
  52. /** A multiboot header */
  53. struct multiboot_header {
  54. uint32_t magic;
  55. uint32_t flags;
  56. uint32_t checksum;
  57. uint32_t header_addr;
  58. uint32_t load_addr;
  59. uint32_t load_end_addr;
  60. uint32_t bss_end_addr;
  61. uint32_t entry_addr;
  62. } __attribute__ (( packed, may_alias ));
  63. /** A multiboot a.out symbol table */
  64. struct multiboot_aout_symbol_table {
  65. uint32_t tabsize;
  66. uint32_t strsize;
  67. uint32_t addr;
  68. uint32_t reserved;
  69. } __attribute__ (( packed, may_alias ));
  70. /** A multiboot ELF section header table */
  71. struct multiboot_elf_section_header_table {
  72. uint32_t num;
  73. uint32_t size;
  74. uint32_t addr;
  75. uint32_t shndx;
  76. } __attribute__ (( packed, may_alias ));
  77. /** A multiboot information structure */
  78. struct multiboot_info {
  79. uint32_t flags;
  80. uint32_t mem_lower;
  81. uint32_t mem_upper;
  82. uint32_t boot_device;
  83. uint32_t cmdline;
  84. uint32_t mods_count;
  85. uint32_t mods_addr;
  86. union {
  87. struct multiboot_aout_symbol_table aout_syms;
  88. struct multiboot_elf_section_header_table elf_sections;
  89. } syms;
  90. uint32_t mmap_length;
  91. uint32_t mmap_addr;
  92. uint32_t drives_length;
  93. uint32_t drives_addr;
  94. uint32_t config_table;
  95. uint32_t boot_loader_name;
  96. uint32_t apm_table;
  97. uint32_t vbe_control_info;
  98. uint32_t vbe_mode_info;
  99. uint16_t vbe_mode;
  100. uint16_t vbe_interface_seg;
  101. uint16_t vbe_interface_off;
  102. uint16_t vbe_interface_len;
  103. } __attribute__ (( packed, may_alias ));
  104. /** A multiboot module structure */
  105. struct multiboot_module {
  106. uint32_t mod_start;
  107. uint32_t mod_end;
  108. uint32_t string;
  109. uint32_t reserved;
  110. } __attribute__ (( packed, may_alias ));
  111. /** A multiboot memory map entry */
  112. struct multiboot_memory_map {
  113. uint32_t size;
  114. uint64_t base_addr;
  115. uint64_t length;
  116. uint32_t type;
  117. } __attribute__ (( packed, may_alias ));
  118. /** Usable RAM */
  119. #define MBMEM_RAM 1
  120. #endif /* _MULTIBOOT_H */