Files
nub-os-2/src/boot/multiboot2.h
nub31 dae0f9e852 ...
2025-12-28 20:05:47 +01:00

222 lines
4.2 KiB
C

#pragma once
#define MULTIBOOT_BOOTLOADER_MAGIC 0x36d76289
#define MULTIBOOT_TAG_ALIGN 8
#define MULTIBOOT_TAG_TYPE_END 0
#define MULTIBOOT_TAG_TYPE_CMDLINE 1
#define MULTIBOOT_TAG_TYPE_BOOT_LOADER_NAME 2
#define MULTIBOOT_TAG_TYPE_MODULE 3
#define MULTIBOOT_TAG_TYPE_BASIC_MEMINFO 4
#define MULTIBOOT_TAG_TYPE_BOOTDEV 5
#define MULTIBOOT_TAG_TYPE_MMAP 6
#define MULTIBOOT_TAG_TYPE_VBE 7
#define MULTIBOOT_TAG_TYPE_FRAMEBUFFER 8
#define MULTIBOOT_TAG_TYPE_ELF_SECTIONS 9
#define MULTIBOOT_TAG_TYPE_APM 10
#define MULTIBOOT_TAG_TYPE_EFI32 11
#define MULTIBOOT_TAG_TYPE_EFI64 12
#define MULTIBOOT_TAG_TYPE_SMBIOS 13
#define MULTIBOOT_TAG_TYPE_ACPI_OLD 14
#define MULTIBOOT_TAG_TYPE_ACPI_NEW 15
#define MULTIBOOT_TAG_TYPE_NETWORK 16
#define MULTIBOOT_TAG_TYPE_EFI_MMAP 17
#define MULTIBOOT_TAG_TYPE_EFI_BS 18
#define MULTIBOOT_TAG_TYPE_EFI32_IH 19
#define MULTIBOOT_TAG_TYPE_EFI64_IH 20
#define MULTIBOOT_TAG_TYPE_LOAD_BASE_ADDR 21
typedef struct {
u8 red;
u8 green;
u8 blue;
} multiboot_color;
#define MULTIBOOT_MEMORY_AVAILABLE 1
#define MULTIBOOT_MEMORY_RESERVED 2
#define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
#define MULTIBOOT_MEMORY_NVS 4
#define MULTIBOOT_MEMORY_BADRAM 5
typedef struct {
u32 type;
u32 size;
} multiboot_tag;
typedef struct {
u32 type;
u32 size;
char string[0];
} multiboot_tag_string;
typedef struct {
u32 type;
u32 size;
u32 mod_start;
u32 mod_end;
char cmdline[0];
} multiboot_tag_module;
typedef struct {
u32 type;
u32 size;
u32 mem_lower;
u32 mem_upper;
} multiboot_tag_basic_meminfo;
typedef struct {
u32 type;
u32 size;
u32 biosdev;
u32 slice;
u32 part;
} multiboot_tag_bootdev;
typedef struct {
u64 addr;
u64 len;
u32 type;
u32 zero;
} multiboot_mmap_entry;
typedef struct {
u32 type;
u32 size;
u32 entry_size;
u32 entry_version;
multiboot_mmap_entry entries[0];
} multiboot_tag_mmap;
typedef struct {
u32 type;
u32 size;
u16 vbe_mode;
u16 vbe_interface_seg;
u16 vbe_interface_off;
u16 vbe_interface_len;
u8 vbe_control_info[512];
u8 vbe_mode_info[256];
} multiboot_tag_vbe;
#define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
#define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
#define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
typedef struct {
u32 type;
u32 size;
u64 framebuffer_addr;
u32 framebuffer_pitch;
u32 framebuffer_width;
u32 framebuffer_height;
u8 framebuffer_bpp;
u8 framebuffer_type;
u16 reserved;
union {
struct {
u16 framebuffer_palette_num_colors;
multiboot_color framebuffer_palette[0];
};
struct {
u8 framebuffer_red_field_position;
u8 framebuffer_red_mask_size;
u8 framebuffer_green_field_position;
u8 framebuffer_green_mask_size;
u8 framebuffer_blue_field_position;
u8 framebuffer_blue_mask_size;
};
};
} multiboot_tag_framebuffer;
typedef struct {
u32 type;
u32 size;
u32 num;
u32 entsize;
u32 shndx;
char sections[0];
} multiboot_tag_elf_sections;
typedef struct {
u32 type;
u32 size;
u16 version;
u16 cseg;
u32 offset;
u16 cseg_16;
u16 dseg;
u16 flags;
u16 cseg_len;
u16 cseg_16_len;
u16 dseg_len;
} multiboot_tag_apm;
typedef struct {
u32 type;
u32 size;
u32 pointer;
} multiboot_tag_efi32;
typedef struct {
u32 type;
u32 size;
u64 pointer;
} multiboot_tag_efi64;
typedef struct {
u32 type;
u32 size;
u8 major;
u8 minor;
u8 reserved[6];
u8 tables[0];
} multiboot_tag_smbios;
typedef struct {
u32 type;
u32 size;
u8 rsdp[0];
} multiboot_tag_old_acpi;
typedef struct {
u32 type;
u32 size;
u8 rsdp[0];
} multiboot_tag_new_acpi;
typedef struct {
u32 type;
u32 size;
u8 dhcpack[0];
} multiboot_tag_network;
typedef struct {
u32 type;
u32 size;
u32 descr_size;
u32 descr_vers;
u8 efi_mmap[0];
} multiboot_tag_efi_mmap;
typedef struct {
u32 type;
u32 size;
u32 pointer;
} multiboot_tag_efi32_ih;
typedef struct {
u32 type;
u32 size;
u64 pointer;
} multiboot_tag_efi64_ih;
typedef struct {
u32 type;
u32 size;
u32 load_base_addr;
} multiboot_tag_load_base_addr;