PatchworkOS
da8a090
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
#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
24
static
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
uint32_t
*
physAddr
;
45
uint32_t
*
virtAddr
;
46
uint64_t
size
;
47
uint32_t
width
;
48
uint32_t
height
;
49
uint32_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
uint64_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
uint64_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
void
*
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
#define MAX_NAME
Maximum length of names.
Definition
MAX_NAME.h:11
boot_is_mem_ram
static bool boot_is_mem_ram(EFI_MEMORY_TYPE type)
Definition
boot_info.h:24
elf.h
io.h
list.h
paging_types.h
stdint.h
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:15
uint64_t
__UINT64_TYPE__ uint64_t
Definition
stdint.h:17
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::data
void * data
Definition
boot_info.h:68
boot_file_t::size
uint64_t size
Definition
boot_info.h:69
boot_gop_t
Definition
boot_info.h:43
boot_gop_t::width
uint32_t width
Definition
boot_info.h:47
boot_gop_t::size
uint64_t size
Definition
boot_info.h:46
boot_gop_t::virtAddr
uint32_t * virtAddr
Definition
boot_info.h:45
boot_gop_t::height
uint32_t height
Definition
boot_info.h:48
boot_gop_t::physAddr
uint32_t * physAddr
Definition
boot_info.h:44
boot_gop_t::stride
uint32_t stride
Definition
boot_info.h:49
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
void * 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::length
uint64_t length
Definition
boot_info.h:58
boot_memory_map_t::descVersion
UINT32 descVersion
Definition
boot_info.h:60
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:36
list_t
A doubly linked list.
Definition
list.h:49
page_table_t
A page table structure.
Definition
paging_types.h:378
include
boot
boot_info.h
Generated on Fri Dec 12 2025 00:22:10 for PatchworkOS by
1.9.8