grub.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2006-10-09 Bernard the grub related definitions
  9. * (multiboot)
  10. */
  11. #ifndef __GRUB_H__
  12. #define __GRUB_H__
  13. /* the magic number for the multiboot header. */
  14. #define MULTIBOOT_HEADER_MAGIC 0x1BADB002
  15. /* the flags for the multiboot header. */
  16. #define MULTIBOOT_HEADER_FLAGS 0x00000003
  17. /* the magic number passed by a multiboot-compliant boot loader. */
  18. #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
  19. #ifndef __ASM__
  20. /* the multiboot header. */
  21. typedef struct multiboot_header
  22. {
  23. unsigned long magic;
  24. unsigned long flags;
  25. unsigned long checksum;
  26. unsigned long header_addr;
  27. unsigned long load_addr;
  28. unsigned long load_end_addr;
  29. unsigned long bss_end_addr;
  30. unsigned long entry_addr;
  31. } multiboot_header_t;
  32. /* the section header table for elf. */
  33. typedef struct elf_section_header_table
  34. {
  35. unsigned long num;
  36. unsigned long size;
  37. unsigned long addr;
  38. unsigned long shndx;
  39. } elf_section_header_table_t;
  40. /* the multiboot information. */
  41. typedef struct multiboot_info
  42. {
  43. unsigned long flags;
  44. unsigned long mem_lower;
  45. unsigned long mem_upper;
  46. unsigned long boot_device;
  47. unsigned long cmdline;
  48. unsigned long mods_count;
  49. unsigned long mods_addr;
  50. union
  51. {
  52. aout_symbol_table_t aout_sym;
  53. elf_section_header_table_t elf_sec;
  54. } u;
  55. unsigned long mmap_length;
  56. unsigned long mmap_addr;
  57. } multiboot_info_t;
  58. /* the module structure. */
  59. typedef struct module
  60. {
  61. unsigned long mod_start;
  62. unsigned long mod_end;
  63. unsigned long string;
  64. unsigned long reserved;
  65. } module_t;
  66. /* the memory map. be careful that the offset 0 is base_addr_low
  67. but no size. */
  68. typedef struct memory_map
  69. {
  70. unsigned long size;
  71. unsigned long base_addr_low;
  72. unsigned long base_addr_high;
  73. unsigned long length_low;
  74. unsigned long length_high;
  75. unsigned long type;
  76. } memory_map_t;
  77. #endif
  78. #endif