128 lines
3.7 KiB
C
128 lines
3.7 KiB
C
#ifndef MULTIBOOT2_H
|
|
#define MULTIBOOT2_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#define MULTIBOOT2_MAGIC 0xE85250D6u
|
|
#define MULTIBOOT2_ARCHITECTURE_I386 0u
|
|
|
|
typedef struct {
|
|
uint32_t magic;
|
|
uint32_t architecture;
|
|
uint32_t header_length;
|
|
uint32_t checksum;
|
|
} multiboot2_header_t;
|
|
#define multiboot2_header(magic, architecture, header_length) \
|
|
{(magic), (architecture), (header_length), (uint32_t)(0x100000000u - (magic) - (architecture) - (header_length))}
|
|
#define multiboot2_header_default() \
|
|
multiboot2_header(MULTIBOOT2_MAGIC, MULTIBOOT2_ARCHITECTURE_I386, sizeof(multiboot2_header_t))
|
|
|
|
typedef struct {
|
|
uint16_t type;
|
|
uint16_t flags;
|
|
uint32_t size;
|
|
} multiboot2_tag_t;
|
|
#define multiboot2_end_tag() {0u, 0u, 8u}
|
|
|
|
typedef struct {
|
|
multiboot2_tag_t header;
|
|
uint32_t width;
|
|
uint32_t height;
|
|
uint32_t depth;
|
|
uint32_t _padding;
|
|
} multiboot2_framebuffer_tag_t;
|
|
#define multiboot2_framebuffer_tag(width, height, depth) \
|
|
{{5u, 0u, 20u}, width, height, depth}
|
|
|
|
#define MULTIBOOT2_INFO_TAG_ALIGNMENT 8u
|
|
#define MULTIBOOT2_INFO_BOOT_COMMAND_LINE 1u
|
|
#define MULTIBOOT2_INFO_BOOT_LOADER_NAME 2u
|
|
#define MULTIBOOT2_INFO_MODULES 3u
|
|
#define MULTIBOOT2_INFO_BASIC_MEMORY_INFO 4u
|
|
#define MULTIBOOT2_INFO_BIOS_BOOT_DEVICE 5u
|
|
#define MULTIBOOT2_INFO_MEMORY_MAP 6u
|
|
#define MULTIBOOT2_INFO_VBE_INFO 7u
|
|
#define MULTIBOOT2_INFO_FRAMEBUFFER_INFO 8u
|
|
#define MULTIBOOT2_INFO_ELF_SYMBOLS 9u
|
|
#define MULTIBOOT2_INFO_APM_TABLE 10u
|
|
#define MULTIBOOT2_INFO_EFI_32BIT_SYSTEM_TABLE_POINTER 11u
|
|
#define MULTIBOOT2_INFO_EFI_64BIT_SYSTEM_TABLE_POINTER 12u
|
|
#define MULTIBOOT2_INFO_SMBIOS_TABLES 13u
|
|
#define MULTIBOOT2_INFO_ACPI_OLD_RSDP 14u
|
|
#define MULTIBOOT2_INFO_NETWORKING_INFO 16u
|
|
#define MULTIBOOT2_INFO_EFI_MEMORY_MAP 17u
|
|
#define MULTIBOOT2_INFO_EFI_BOOT_SERVICES_NOT_TERMINATED 18u
|
|
#define MULTIBOOT2_INFO_EFI_32BIT_IMAGE_HANDLE_POINTER 19u
|
|
#define MULTIBOOT2_INFO_EFI_64BIT_IMAGE_HANDLE_POINTER 20u
|
|
#define MULTIBOOT2_INFO_IMAGE_LOAD_BASE_PHYSICAL_ADDRESS 21u
|
|
|
|
typedef struct {
|
|
uint32_t total_size;
|
|
uint32_t _reserved;
|
|
} multiboot2_info_header_t;
|
|
|
|
typedef struct {
|
|
uint32_t type;
|
|
uint32_t size;
|
|
} multiboot2_info_tag_t;
|
|
#define multiboot2_info_next_tag(current_tag) \
|
|
(multiboot2_info_tag_t *)(((uintptr_t)current_tag + current_tag->size + MULTIBOOT2_INFO_TAG_ALIGNMENT - 1u) & ~(MULTIBOOT2_INFO_TAG_ALIGNMENT - 1u))
|
|
|
|
typedef struct {
|
|
multiboot2_info_tag_t header;
|
|
char string[];
|
|
} multiboot2_info_boot_command_line_t;
|
|
|
|
typedef struct {
|
|
multiboot2_info_tag_t header;
|
|
char string[];
|
|
} multiboot2_info_boot_loader_name_t;
|
|
|
|
typedef struct {
|
|
multiboot2_info_tag_t header;
|
|
uint32_t mem_lower;
|
|
uint32_t mem_upper;
|
|
} multiboot2_info_basic_memory_info_t;
|
|
|
|
#define MULTIBOOT2_MEMORY_MAP_TYPE_RAM 1u
|
|
#define MULTIBOOT2_MEMORY_MAP_TYPE_ACPI 3u
|
|
#define MULTIBOOT2_MEMORY_MAP_TYPE_PRESERVE 4u
|
|
#define MULTIBOOT2_MEMORY_MAP_TYPE_DEFECTIVE 5u
|
|
|
|
typedef struct {
|
|
uint64_t base_addr;
|
|
uint64_t length;
|
|
uint32_t type;
|
|
uint32_t _reserved;
|
|
} multiboot2_info_memory_map_entry_t;
|
|
|
|
typedef struct {
|
|
multiboot2_info_tag_t header;
|
|
uint32_t entry_size;
|
|
uint32_t entry_version;
|
|
multiboot2_info_memory_map_entry_t entries[];
|
|
} multiboot2_info_memory_map_t;
|
|
|
|
typedef struct {
|
|
multiboot2_info_tag_t header;
|
|
uint16_t vbe_mode;
|
|
uint16_t vbe_interface_set;
|
|
uint16_t vbe_interface_off;
|
|
uint16_t vbe_interface_len;
|
|
uint8_t vbe_control_info[512];
|
|
uint8_t vbe_mode_info[256];
|
|
} multiboot2_info_vbe_info_t;
|
|
|
|
typedef struct {
|
|
multiboot2_info_tag_t header;
|
|
uint64_t framebuffer_addr;
|
|
uint32_t framebuffer_pitch;
|
|
uint32_t framebuffer_width;
|
|
uint32_t framebuffer_height;
|
|
uint8_t framebuffer_bpp;
|
|
uint8_t framebuffer_type;
|
|
uint8_t _reserved;
|
|
} multiboot2_info_framebuffer_info_t;
|
|
|
|
#endif
|