PatchworkOS
19e446b
A non-POSIX operating system.
Theme:
Default
Round
Robot
Loading...
Searching...
No Matches
boot_info.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
kernel/mem/paging_types.h
>
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
24
static
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
}
42
typedef
struct
43
{
44
phys_addr_t
physAddr
;
45
uint32_t
*
virtAddr
;
46
size_t
size
;
47
size_t
width
;
48
size_t
height
;
49
size_t
stride
;
50
}
boot_gop_t
;
51
52
#define BOOT_MEMORY_MAP_GET_DESCRIPTOR(map, index) \
53
(EFI_MEMORY_DESCRIPTOR*)((uint64_t)(map)->descriptors + ((index) * (map)->descSize))
54
55
typedef
struct
56
{
57
EFI_MEMORY_DESCRIPTOR*
descriptors
;
58
size_t
length
;
59
UINTN
descSize
;
60
UINT32
descVersion
;
61
UINTN
key
;
62
}
boot_memory_map_t
;
63
64
typedef
struct
boot_file
65
{
66
list_entry_t
entry
;
67
char
name[
MAX_NAME
];
68
void
*
data
;
69
size_t
size
;
70
}
boot_file_t
;
71
72
typedef
struct
boot_dir
73
{
74
list_entry_t
entry
;
75
char
name[
MAX_NAME
];
76
list_t
children
;
77
list_t
files
;
78
}
boot_dir_t
;
79
80
typedef
struct
boot_disk
81
{
82
boot_dir_t
*
root
;
83
}
boot_disk_t
;
84
85
typedef
struct
boot_info
boot_info_t
;
86
87
typedef
struct
88
{
89
Elf64_File
elf
;
90
phys_addr_t
physAddr
;
91
}
boot_kernel_t
;
92
93
typedef
struct
94
{
95
boot_memory_map_t
map
;
96
page_table_t
table
;
97
}
boot_memory_t
;
98
99
typedef
struct
boot_info
100
{
101
boot_gop_t
gop
;
102
void
*
rsdp
;
103
void
*
runtimeServices
;
104
boot_disk_t
disk
;
105
boot_kernel_t
kernel
;
106
boot_memory_t
memory
;
107
}
boot_info_t
;
108
109
/** @} */
MAX_NAME.h
MAX_NAME
#define MAX_NAME
Maximum length of names.
Definition
MAX_NAME.h:11
defs.h
boot_is_mem_ram
static UNUSED_FUNC bool boot_is_mem_ram(EFI_MEMORY_TYPE type)
Definition
boot_info.h:24
phys_addr_t
uintptr_t phys_addr_t
Physical address type.
Definition
paging_types.h:42
UNUSED_FUNC
#define UNUSED_FUNC
GCC unused function attribute.
Definition
defs.h:103
elf.h
list.h
paging_types.h
stdint.h
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:15
Elf64_File
ELF File Helper structure.
Definition
elf.h:781
boot_dir_t
Definition
boot_info.h:73
boot_dir_t::files
list_t files
Definition
boot_info.h:77
boot_dir_t::children
list_t children
Definition
boot_info.h:76
boot_dir_t::entry
list_entry_t entry
Definition
boot_info.h:74
boot_disk_t
Definition
boot_info.h:81
boot_disk_t::root
boot_dir_t * root
Definition
boot_info.h:82
boot_file_t
Definition
boot_info.h:65
boot_file_t::entry
list_entry_t entry
Definition
boot_info.h:66
boot_file_t::size
size_t size
Definition
boot_info.h:69
boot_file_t::data
void * data
Definition
boot_info.h:68
boot_gop_t
Definition
boot_info.h:43
boot_gop_t::size
size_t size
Definition
boot_info.h:46
boot_gop_t::stride
size_t stride
Definition
boot_info.h:49
boot_gop_t::physAddr
phys_addr_t physAddr
Definition
boot_info.h:44
boot_gop_t::virtAddr
uint32_t * virtAddr
Definition
boot_info.h:45
boot_gop_t::width
size_t width
Definition
boot_info.h:47
boot_gop_t::height
size_t height
Definition
boot_info.h:48
boot_info_t
Definition
boot_info.h:100
boot_info_t::memory
boot_memory_t memory
Definition
boot_info.h:106
boot_info_t::runtimeServices
void * runtimeServices
Definition
boot_info.h:103
boot_info_t::disk
boot_disk_t disk
Definition
boot_info.h:104
boot_info_t::gop
boot_gop_t gop
Definition
boot_info.h:101
boot_info_t::rsdp
void * rsdp
Definition
boot_info.h:102
boot_info_t::kernel
boot_kernel_t kernel
Definition
boot_info.h:105
boot_kernel_t
Definition
boot_info.h:88
boot_kernel_t::physAddr
phys_addr_t physAddr
Definition
boot_info.h:90
boot_kernel_t::elf
Elf64_File elf
Definition
boot_info.h:89
boot_memory_map_t
Definition
boot_info.h:56
boot_memory_map_t::key
UINTN key
Definition
boot_info.h:61
boot_memory_map_t::descVersion
UINT32 descVersion
Definition
boot_info.h:60
boot_memory_map_t::length
size_t length
Definition
boot_info.h:58
boot_memory_map_t::descriptors
EFI_MEMORY_DESCRIPTOR * descriptors
Definition
boot_info.h:57
boot_memory_map_t::descSize
UINTN descSize
Definition
boot_info.h:59
boot_memory_t
Definition
boot_info.h:94
boot_memory_t::table
page_table_t table
Definition
boot_info.h:96
boot_memory_t::map
boot_memory_map_t map
Definition
boot_info.h:95
list_entry_t
A entry in a doubly linked list.
Definition
list.h:37
list_t
A doubly linked list.
Definition
list.h:46
page_table_t
A page table structure.
Definition
paging_types.h:434
include
boot
boot_info.h
Generated on Sat Jan 24 2026 10:59:24 for PatchworkOS by
1.9.8