Multiboot.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #pragma once
  2. #include <AK/Types.h>
  3. struct multiboot_aout_symbol_table {
  4. dword tabsize;
  5. dword strsize;
  6. dword addr;
  7. dword reserved;
  8. };
  9. typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t;
  10. struct multiboot_elf_section_header_table {
  11. dword num;
  12. dword size;
  13. dword addr;
  14. dword shndx;
  15. };
  16. typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t;
  17. #define MULTIBOOT_MEMORY_AVAILABLE 1
  18. #define MULTIBOOT_MEMORY_RESERVED 2
  19. #define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
  20. #define MULTIBOOT_MEMORY_NVS 4
  21. #define MULTIBOOT_MEMORY_BADRAM 5
  22. struct multiboot_mmap_entry {
  23. dword size;
  24. qword addr;
  25. qword len;
  26. dword type;
  27. } __attribute__((packed));
  28. typedef struct multiboot_mmap_entry multiboot_memory_map_t;
  29. struct multiboot_info {
  30. // Multiboot info version number.
  31. dword flags;
  32. // Available memory from BIOS.
  33. dword mem_lower;
  34. dword mem_upper;
  35. // "root" partition.
  36. dword boot_device;
  37. // Kernel command line.
  38. dword cmdline;
  39. // Boot-Module list.
  40. dword mods_count;
  41. dword mods_addr;
  42. union {
  43. multiboot_aout_symbol_table_t aout_sym;
  44. multiboot_elf_section_header_table_t elf_sec;
  45. } u;
  46. // Memory Mapping buffer.
  47. dword mmap_length;
  48. dword mmap_addr;
  49. // Drive Info buffer.
  50. dword drives_length;
  51. dword drives_addr;
  52. // ROM configuration table.
  53. dword config_table;
  54. // Boot Loader Name.
  55. dword boot_loader_name;
  56. // APM table.
  57. dword apm_table;
  58. // Video.
  59. dword vbe_control_info;
  60. dword vbe_mode_info;
  61. word vbe_mode;
  62. word vbe_interface_seg;
  63. word vbe_interface_off;
  64. word vbe_interface_len;
  65. qword framebuffer_addr;
  66. dword framebuffer_pitch;
  67. dword framebuffer_width;
  68. dword framebuffer_height;
  69. byte framebuffer_bpp;
  70. #define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
  71. #define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
  72. #define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
  73. byte framebuffer_type;
  74. union {
  75. struct
  76. {
  77. dword framebuffer_palette_addr;
  78. word framebuffer_palette_num_colors;
  79. };
  80. struct
  81. {
  82. byte framebuffer_red_field_position;
  83. byte framebuffer_red_mask_size;
  84. byte framebuffer_green_field_position;
  85. byte framebuffer_green_mask_size;
  86. byte framebuffer_blue_field_position;
  87. byte framebuffer_blue_mask_size;
  88. };
  89. };
  90. };
  91. typedef struct multiboot_info multiboot_info_t;
  92. extern "C" multiboot_info_t* multiboot_info_ptr;