Serenity Operating System
at hosted 137 lines 3.9 kB view raw
1/* 2 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, this 9 * list of conditions and the following disclaimer. 10 * 11 * 2. Redistributions in binary form must reproduce the above copyright notice, 12 * this list of conditions and the following disclaimer in the documentation 13 * and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#pragma once 28 29#include <AK/Types.h> 30 31struct multiboot_aout_symbol_table { 32 u32 tabsize; 33 u32 strsize; 34 u32 addr; 35 u32 reserved; 36}; 37typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t; 38 39struct multiboot_elf_section_header_table { 40 u32 num; 41 u32 size; 42 u32 addr; 43 u32 shndx; 44}; 45typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t; 46 47#define MULTIBOOT_MEMORY_AVAILABLE 1 48#define MULTIBOOT_MEMORY_RESERVED 2 49#define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3 50#define MULTIBOOT_MEMORY_NVS 4 51#define MULTIBOOT_MEMORY_BADRAM 5 52 53struct multiboot_mmap_entry { 54 u32 size; 55 u64 addr; 56 u64 len; 57 u32 type; 58} __attribute__((packed)); 59typedef struct multiboot_mmap_entry multiboot_memory_map_t; 60 61struct multiboot_info { 62 // Multiboot info version number. 63 u32 flags; 64 65 // Available memory from BIOS. 66 u32 mem_lower; 67 u32 mem_upper; 68 69 // "root" partition. 70 u32 boot_device; 71 72 // Kernel command line. 73 u32 cmdline; 74 75 // Boot-Module list. 76 u32 mods_count; 77 u32 mods_addr; 78 79 union { 80 multiboot_aout_symbol_table_t aout_sym; 81 multiboot_elf_section_header_table_t elf_sec; 82 } u; 83 84 // Memory Mapping buffer. 85 u32 mmap_length; 86 u32 mmap_addr; 87 88 // Drive Info buffer. 89 u32 drives_length; 90 u32 drives_addr; 91 92 // ROM configuration table. 93 u32 config_table; 94 95 // Boot Loader Name. 96 u32 boot_loader_name; 97 98 // APM table. 99 u32 apm_table; 100 101 // Video. 102 u32 vbe_control_info; 103 u32 vbe_mode_info; 104 u16 vbe_mode; 105 u16 vbe_interface_seg; 106 u16 vbe_interface_off; 107 u16 vbe_interface_len; 108 109 u64 framebuffer_addr; 110 u32 framebuffer_pitch; 111 u32 framebuffer_width; 112 u32 framebuffer_height; 113 u8 framebuffer_bpp; 114#define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0 115#define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1 116#define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2 117 u8 framebuffer_type; 118 union { 119 struct 120 { 121 u32 framebuffer_palette_addr; 122 u16 framebuffer_palette_num_colors; 123 }; 124 struct 125 { 126 u8 framebuffer_red_field_position; 127 u8 framebuffer_red_mask_size; 128 u8 framebuffer_green_field_position; 129 u8 framebuffer_green_mask_size; 130 u8 framebuffer_blue_field_position; 131 u8 framebuffer_blue_mask_size; 132 }; 133 }; 134}; 135typedef struct multiboot_info multiboot_info_t; 136 137extern "C" multiboot_info_t* multiboot_info_ptr;