/* See the end of this file for copyright and license terms. */ #pragma once /* * Multiboot 2 header definitions and structures, see the GNU documentation: * */ #define MB2_SEARCH 32768 #define MB2_HEADER_ALIGN 8 /* The magic field should contain this. */ #define MB2_HEADER_MAGIC 0xe85250d6 /* This should be in %eax. */ #define MB2_BOOTLOADER_MAGIC 0x36d76289 /* Alignment of multiboot modules. */ #define MB2_MOD_ALIGN 0x00001000 /* Alignment of the multiboot info structure. */ #define MB2_INFO_ALIGN 0x00000008 /* Alignment of multiboot header tags. */ #define MB2_TAG_ALIGN 8 #define MB2_TAG_TYPE_END 0 #define MB2_TAG_TYPE_CMDLINE 1 #define MB2_TAG_TYPE_BOOT_LOADER_NAME 2 #define MB2_TAG_TYPE_MODULE 3 #define MB2_TAG_TYPE_BASIC_MEMINFO 4 #define MB2_TAG_TYPE_BOOTDEV 5 #define MB2_TAG_TYPE_MMAP 6 #define MB2_TAG_TYPE_VBE 7 #define MB2_TAG_TYPE_FRAMEBUFFER 8 #define MB2_TAG_TYPE_ELF_SECTIONS 9 #define MB2_TAG_TYPE_APM 10 #define MB2_TAG_TYPE_EFI32 11 #define MB2_TAG_TYPE_EFI64 12 #define MB2_TAG_TYPE_SMBIOS 13 #define MB2_TAG_TYPE_ACPI_OLD 14 #define MB2_TAG_TYPE_ACPI_NEW 15 #define MB2_TAG_TYPE_NETWORK 16 #define MB2_TAG_TYPE_EFI_MMAP 17 #define MB2_TAG_TYPE_EFI_BS 18 #define MB2_TAG_TYPE_EFI32_IH 19 #define MB2_TAG_TYPE_EFI64_IH 20 #define MB2_TAG_TYPE_LOAD_BASE_ADDR 21 #define MB2_HEADER_TAG_END 0 #define MB2_HEADER_TAG_INFORMATION_REQUEST 1 #define MB2_HEADER_TAG_ADDRESS 2 #define MB2_HEADER_TAG_ENTRY_ADDRESS 3 #define MB2_HEADER_TAG_CONSOLE_FLAGS 4 #define MB2_HEADER_TAG_FRAMEBUFFER 5 #define MB2_HEADER_TAG_MODULE_ALIGN 6 #define MB2_HEADER_TAG_EFI_BS 7 #define MB2_HEADER_TAG_ENTRY_ADDRESS_EFI32 8 #define MB2_HEADER_TAG_ENTRY_ADDRESS_EFI64 9 #define MB2_HEADER_TAG_RELOCATABLE 10 #define MB2_ARCHITECTURE_I386 0 #define MB2_ARCHITECTURE_MIPS32 4 #define MB2_HEADER_TAG_OPTIONAL 1 #define MB2_LOAD_PREFERENCE_NONE 0 #define MB2_LOAD_PREFERENCE_LOW 1 #define MB2_LOAD_PREFERENCE_HIGH 2 #define MB2_CONSOLE_FLAGS_CONSOLE_REQUIRED 1 #define MB2_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED 2 #ifndef _ASM_SOURCE #include /* implemented in boot/multiboot.S */ struct mb2_header { u32 magic; /**< = MB2_HEADER_MAGIC */ u32 architecture; /**< ISA */ u32 header_length; /**< Total header length in bytes */ u32 checksum; /**< Sum of all 4 members % (1 << 32) = 0 */ }; struct mb2_header_tag { u16 type; u16 flags; u32 size; }; struct mb2_header_tag_information_request { struct mb2_header_tag header; u32 requests[]; }; struct mb2_header_tag_address { struct mb2_header_tag header; u32 header_addr; u32 load_addr; u32 load_end_addr; u32 bss_end_addr; }; struct mb2_header_tag_entry_address { struct mb2_header_tag header; u32 entry_addr; }; struct mb2_header_tag_console_flags { struct mb2_header_tag header; u32 console_flags; }; struct mb2_header_tag_framebuffer { struct mb2_header_tag header; u32 width; u32 height; u32 depth; }; struct mb2_header_tag_module_align { struct mb2_header_tag header; }; struct mb2_header_tag_relocatable { struct mb2_header_tag header; u32 min_addr; u32 max_addr; u32 align; u32 preference; }; struct mb2_color { u8 red; u8 green; u8 blue; }; struct mb2_mmap_entry { u64 addr; u64 len; u32 type; #define MB2_MEMORY_AVAILABLE 1 #define MB2_MEMORY_RESERVED 2 #define MB2_MEMORY_ACPI_RECLAIMABLE 3 #define MB2_MEMORY_NVS 4 #define MB2_MEMORY_BADRAM 5 u32 zero; }; typedef struct mb2_mmap_entry mb2_memory_map_t; struct mb2_tag { u32 type; u32 size; }; struct mb2_tag_string { struct mb2_tag tag; char string[]; }; struct mb2_tag_module { struct mb2_tag tag; u32 mod_start; u32 mod_end; char cmdline[]; }; struct mb2_tag_basic_meminfo { struct mb2_tag tag; u32 mem_lower; u32 mem_upper; }; struct mb2_tag_bootdev { struct mb2_tag tag; u32 biosdev; u32 slice; u32 part; }; struct mb2_tag_mmap { struct mb2_tag tag; u32 entry_size; u32 entry_version; struct mb2_mmap_entry entries[]; }; struct mb2_vbe_info_block { u8 external_specification[512]; }; struct mb2_vbe_mode_info_block { u8 external_specification[256]; }; struct mb2_tag_vbe { struct mb2_tag tag; u16 vbe_mode; u16 vbe_interface_seg; u16 vbe_interface_off; u16 vbe_interface_len; struct mb2_vbe_info_block vbe_control_info; struct mb2_vbe_mode_info_block vbe_mode_info; }; struct mb2_tag_framebuffer_common { struct mb2_tag tag; u64 framebuffer_addr; u32 framebuffer_pitch; u32 framebuffer_width; u32 framebuffer_height; u8 framebuffer_bpp; u8 framebuffer_type; #define MB2_FRAMEBUFFER_TYPE_INDEXED 0 #define MB2_FRAMEBUFFER_TYPE_RGB 1 #define MB2_FRAMEBUFFER_TYPE_EGA_TEXT 2 u16 reserved; }; struct mb2_tag_framebuffer { struct mb2_tag_framebuffer_common common; union { struct { u16 framebuffer_palette_num_colors; struct mb2_color framebuffer_palette[]; }; 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; }; }; }; struct mb2_tag_elf_sections { struct mb2_tag tag; u32 num; u32 entsize; u32 shndx; char sections[]; }; struct mb2_tag_apm { struct mb2_tag tag; u16 version; u16 cseg; u32 offset; u16 cseg_16; u16 dseg; u16 flags; u16 cseg_len; u16 cseg_16_len; u16 dseg_len; }; struct mb2_tag_efi32 { struct mb2_tag tag; u32 pointer; }; struct mb2_tag_efi64 { struct mb2_tag tag; u64 pointer; }; struct mb2_tag_smbios { struct mb2_tag tag; u8 major; u8 minor; u8 _reserved[6]; u8 tables[]; }; struct mb2_tag_old_acpi { struct mb2_tag tag; u8 rsdp[]; }; struct mb2_tag_new_acpi { struct mb2_tag tag; u8 rsdp[]; }; struct mb2_tag_network { struct mb2_tag tag; u8 dhcpack[]; }; struct mb2_tag_efi_mmap { struct mb2_tag tag; u32 descr_size; u32 descr_vers; u8 efi_mmap[]; }; struct mb2_tag_efi32_ih { struct mb2_tag tag; u32 pointer; }; struct mb2_tag_efi64_ih { struct mb2_tag tag; u64 pointer; }; struct mb2_tag_load_base_addr { struct mb2_tag tag; u32 load_base_addr; }; #endif /* not _ASM_SOURCE */ /* * This file is part of GayBSD. * Copyright (c) 2021 fef . * * GayBSD is nonviolent software: you may only use, redistribute, and/or * modify it under the terms of the Cooperative Nonviolent Public License * (CNPL) as found in the LICENSE file in the source code root directory * or at ; either version 7 * of the license, or (at your option) any later version. * * GayBSD comes with ABSOLUTELY NO WARRANTY, to the extent * permitted by applicable law. See the CNPL for details. * * ============================================================================= * * This file is derived from the FSF's sample multiboot2.h file: * * * Copyright (C) 1999,2003,2007,2008,2009,2010 Free Software Foundation, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ANY * DEVELOPER OR DISTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */