multiboot.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #pragma once
  2. #define MULTIBOOT_MAGIC 0x1BADB002
  3. #define MULTIBOOT_EAX_MAGIC 0x2BADB002
  4. #define MULTIBOOT_FLAG_MEM 0x001
  5. #define MULTIBOOT_FLAG_DEVICE 0x002
  6. #define MULTIBOOT_FLAG_CMDLINE 0x004
  7. #define MULTIBOOT_FLAG_MODS 0x008
  8. #define MULTIBOOT_FLAG_AOUT 0x010
  9. #define MULTIBOOT_FLAG_ELF 0x020
  10. #define MULTIBOOT_FLAG_MMAP 0x040
  11. #define MULTIBOOT_FLAG_DRIVE 0x080
  12. #define MULTIBOOT_FLAG_CONFIG 0x100
  13. #define MULTIBOOT_FLAG_LOADER 0x200
  14. #define MULTIBOOT_FLAG_APM 0x400
  15. #define MULTIBOOT_FLAG_VBE 0x800
  16. struct multiboot
  17. {
  18. uint32_t flags;
  19. uint32_t mem_lower;
  20. uint32_t mem_upper;
  21. uint32_t boot_device;
  22. uint32_t cmdline;
  23. uint32_t mods_count;
  24. uint32_t mods_addr;
  25. uint32_t num;
  26. uint32_t size;
  27. uint32_t addr;
  28. uint32_t shndx;
  29. uint32_t mmap_length;
  30. uint32_t mmap_addr;
  31. uint32_t drives_length;
  32. uint32_t drives_addr;
  33. uint32_t config_table;
  34. uint32_t boot_loader_name;
  35. uint32_t apm_table;
  36. uint32_t vbe_control_info;
  37. uint32_t vbe_mode_info;
  38. uint32_t vbe_mode;
  39. uint32_t vbe_interface_seg;
  40. uint32_t vbe_interface_off;
  41. uint32_t vbe_interface_len;
  42. uint32_t framebuffer_addr;
  43. uint32_t framebuffer_pitch;
  44. uint32_t framebuffer_width;
  45. uint32_t framebuffer_height;
  46. uint8_t framebuffer_bpp;
  47. uint8_t framebuffer_type;
  48. /* Palette stuff goes here but we don't use it */
  49. } __attribute__ ((packed));
  50. typedef struct {
  51. uint16_t attributes;
  52. uint8_t winA, winB;
  53. uint16_t granularity;
  54. uint16_t winsize;
  55. uint16_t segmentA, segmentB;
  56. uint32_t realFctPtr;
  57. uint16_t pitch;
  58. uint16_t Xres, Yres;
  59. uint8_t Wchar, Ychar, planes, bpp, banks;
  60. uint8_t memory_model, bank_size, image_pages;
  61. uint8_t reserved0;
  62. uint8_t red_mask, red_position;
  63. uint8_t green_mask, green_position;
  64. uint8_t blue_mask, blue_position;
  65. uint8_t rsv_mask, rsv_position;
  66. uint8_t directcolor_attributes;
  67. uint32_t physbase;
  68. uint32_t reserved1;
  69. uint16_t reserved2;
  70. } __attribute__ ((packed)) vbe_info_t;
  71. typedef struct {
  72. uint32_t mod_start;
  73. uint32_t mod_end;
  74. uint32_t cmdline;
  75. uint32_t reserved;
  76. } __attribute__ ((packed)) mboot_mod_t;
  77. typedef struct {
  78. uint32_t size;
  79. uint64_t base_addr;
  80. uint64_t length;
  81. uint32_t type;
  82. } __attribute__ ((packed)) mboot_memmap_t;
  83. extern struct multiboot *copy_multiboot(struct multiboot *mboot_ptr);
  84. extern void dump_multiboot(struct multiboot *mboot_ptr);
  85. extern char * ramdisk;
  86. extern struct multiboot * mboot_ptr;
  87. static char cmdline[1024] = {0};