PatchworkOS  19e446b
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
7#include <_libstd/MAX_NAME.h>
8#include <stdint.h>
9#include <sys/defs.h>
10#include <sys/elf.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 UNUSED_FUNC 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}
42typedef struct
43{
46 size_t size;
47 size_t width;
48 size_t height;
49 size_t stride;
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;
58 size_t length;
59 UINTN descSize;
61 UINTN key;
63
64typedef struct boot_file
65{
67 char name[MAX_NAME];
68 void* data;
69 size_t size;
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
92
98
108
109/** @} */
#define MAX_NAME
Maximum length of names.
Definition MAX_NAME.h:11
static UNUSED_FUNC bool boot_is_mem_ram(EFI_MEMORY_TYPE type)
Definition boot_info.h:24
uintptr_t phys_addr_t
Physical address type.
#define UNUSED_FUNC
GCC unused function attribute.
Definition defs.h:103
__UINT32_TYPE__ uint32_t
Definition stdint.h:15
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
size_t size
Definition boot_info.h:69
void * data
Definition boot_info.h:68
size_t size
Definition boot_info.h:46
size_t stride
Definition boot_info.h:49
phys_addr_t physAddr
Definition boot_info.h:44
uint32_t * virtAddr
Definition boot_info.h:45
size_t width
Definition boot_info.h:47
size_t height
Definition boot_info.h:48
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
phys_addr_t physAddr
Definition boot_info.h:90
Elf64_File elf
Definition boot_info.h:89
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:37
A doubly linked list.
Definition list.h:46
A page table structure.