PatchworkOS  da8a090
A non-POSIX operating system.
Loading...
Searching...
No Matches
boot_info.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <gnu-efi/inc/efi.h>
6#include <gnu-efi/inc/efilib.h>
7
8#include <stdint.h>
9#include <sys/elf.h>
10#include <sys/io.h>
11#include <sys/list.h>
12
13/**
14 * @brief Boot information.
15 * @defgroup boot_info Boot Information
16 * @ingroup boot
17 *
18 * The boot information structure is used to pass information from the bootloader to the kernel, such as memory map, or
19 * `rsdp`.
20 *
21 * @{
22 */
23
24static bool boot_is_mem_ram(EFI_MEMORY_TYPE type)
25{
26 switch (type)
27 {
28 case EfiConventionalMemory:
29 case EfiLoaderCode:
30 case EfiLoaderData:
31 case EfiBootServicesCode:
32 case EfiBootServicesData:
33 case EfiRuntimeServicesCode:
34 case EfiRuntimeServicesData:
35 case EfiACPIReclaimMemory:
36 case EfiACPIMemoryNVS:
37 return true;
38 default:
39 return false;
40 }
41}
51
52#define BOOT_MEMORY_MAP_GET_DESCRIPTOR(map, index) \
53 (EFI_MEMORY_DESCRIPTOR*)((uint64_t)(map)->descriptors + ((index) * (map)->descSize))
54
55typedef struct
56{
57 EFI_MEMORY_DESCRIPTOR* descriptors;
59 UINTN descSize;
61 UINTN key;
63
64typedef struct boot_file
65{
67 char name[MAX_NAME];
68 void* data;
71
72typedef struct boot_dir
73{
75 char name[MAX_NAME];
79
80typedef struct boot_disk
81{
84
85typedef struct boot_info boot_info_t;
86
87typedef struct
88{
90 void* physAddr;
92
98
108
109/** @} */
#define MAX_NAME
Maximum length of names.
Definition MAX_NAME.h:11
static bool boot_is_mem_ram(EFI_MEMORY_TYPE type)
Definition boot_info.h:24
__UINT32_TYPE__ uint32_t
Definition stdint.h:15
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
ELF File Helper structure.
Definition elf.h:781
list_t files
Definition boot_info.h:77
list_t children
Definition boot_info.h:76
list_entry_t entry
Definition boot_info.h:74
boot_dir_t * root
Definition boot_info.h:82
list_entry_t entry
Definition boot_info.h:66
void * data
Definition boot_info.h:68
uint64_t size
Definition boot_info.h:69
uint32_t width
Definition boot_info.h:47
uint64_t size
Definition boot_info.h:46
uint32_t * virtAddr
Definition boot_info.h:45
uint32_t height
Definition boot_info.h:48
uint32_t * physAddr
Definition boot_info.h:44
uint32_t stride
Definition boot_info.h:49
boot_memory_t memory
Definition boot_info.h:106
void * runtimeServices
Definition boot_info.h:103
boot_disk_t disk
Definition boot_info.h:104
boot_gop_t gop
Definition boot_info.h:101
void * rsdp
Definition boot_info.h:102
boot_kernel_t kernel
Definition boot_info.h:105
void * physAddr
Definition boot_info.h:90
Elf64_File elf
Definition boot_info.h:89
uint64_t length
Definition boot_info.h:58
EFI_MEMORY_DESCRIPTOR * descriptors
Definition boot_info.h:57
page_table_t table
Definition boot_info.h:96
boot_memory_map_t map
Definition boot_info.h:95
A entry in a doubly linked list.
Definition list.h:36
A doubly linked list.
Definition list.h:49
A page table structure.