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

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