PatchworkOS
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
static
bool
boot_is_mem_ram
(EFI_MEMORY_TYPE type)
14
{
15
switch
(type)
16
{
17
case
EfiConventionalMemory:
18
case
EfiLoaderCode:
19
case
EfiLoaderData:
20
case
EfiBootServicesCode:
21
case
EfiBootServicesData:
22
case
EfiRuntimeServicesCode:
23
case
EfiRuntimeServicesData:
24
case
EfiACPIReclaimMemory:
25
case
EfiACPIMemoryNVS:
26
return
true
;
27
default
:
28
return
false
;
29
}
30
}
31
typedef
struct
32
{
33
uint32_t
*
physAddr
;
34
uint32_t
*
virtAddr
;
35
uint64_t
size
;
36
uint32_t
width
;
37
uint32_t
height
;
38
uint32_t
stride
;
39
}
boot_gop_t
;
40
41
#define BOOT_MEMORY_MAP_GET_DESCRIPTOR(map, index) \
42
(EFI_MEMORY_DESCRIPTOR*)((uint64_t)(map)->descriptors + ((index) * (map)->descSize))
43
44
typedef
struct
45
{
46
EFI_MEMORY_DESCRIPTOR*
descriptors
;
47
uint64_t
length
;
48
UINTN
descSize
;
49
UINT32
descVersion
;
50
UINTN
key
;
51
}
boot_memory_map_t
;
52
53
typedef
struct
boot_dir
boot_dir_t
;
54
55
typedef
struct
boot_file
56
{
57
list_entry_t
entry
;
58
char
name[
MAX_NAME
];
59
void
*
data
;
60
uint64_t
size
;
61
}
boot_file_t
;
62
63
typedef
struct
boot_dir
64
{
65
list_entry_t
entry
;
66
char
name[
MAX_NAME
];
67
list_t
children
;
68
list_t
files
;
69
}
boot_dir_t
;
70
71
typedef
struct
boot_disk
72
{
73
boot_dir_t
*
root
;
74
}
boot_disk_t
;
75
76
typedef
struct
boot_info
boot_info_t
;
77
78
typedef
struct
79
{
80
elf_hdr_t
header
;
81
elf_phdr_t
*
phdrs
;
82
elf_shdr_t
*
shdrs
;
83
uint32_t
shdrCount
;
84
elf_sym_t
*
symbols
;
85
uint32_t
symbolCount
;
86
char
*
stringTable
;
87
uint64_t
stringTableSize
;
88
uintptr_t
physStart
;
89
uintptr_t
virtStart
;
90
void (*entry)(
boot_info_t
*);
91
uint64_t
size
;
92
}
boot_kernel_t
;
93
94
typedef
struct
95
{
96
boot_memory_map_t
map
;
97
page_table_t
table
;
98
}
boot_memory_t
;
99
100
typedef
struct
boot_info
101
{
102
boot_gop_t
gop
;
103
void
*
rsdp
;
104
void
*
runtimeServices
;
105
boot_disk_t
disk
;
106
boot_kernel_t
kernel
;
107
boot_memory_t
memory
;
108
}
boot_info_t
;
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:13
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
uintptr_t
__UINTPTR_TYPE__ uintptr_t
Definition
stdint.h:43
boot_dir_t
Definition
boot_info.h:64
boot_dir_t::files
list_t files
Definition
boot_info.h:68
boot_dir_t::children
list_t children
Definition
boot_info.h:67
boot_dir_t::entry
list_entry_t entry
Definition
boot_info.h:65
boot_disk_t
Definition
boot_info.h:72
boot_disk_t::root
boot_dir_t * root
Definition
boot_info.h:73
boot_file_t
Definition
boot_info.h:56
boot_file_t::entry
list_entry_t entry
Definition
boot_info.h:57
boot_file_t::data
void * data
Definition
boot_info.h:59
boot_file_t::size
uint64_t size
Definition
boot_info.h:60
boot_gop_t
Definition
boot_info.h:32
boot_gop_t::width
uint32_t width
Definition
boot_info.h:36
boot_gop_t::size
uint64_t size
Definition
boot_info.h:35
boot_gop_t::virtAddr
uint32_t * virtAddr
Definition
boot_info.h:34
boot_gop_t::height
uint32_t height
Definition
boot_info.h:37
boot_gop_t::physAddr
uint32_t * physAddr
Definition
boot_info.h:33
boot_gop_t::stride
uint32_t stride
Definition
boot_info.h:38
boot_info_t
Definition
boot_info.h:101
boot_info_t::memory
boot_memory_t memory
Definition
boot_info.h:107
boot_info_t::runtimeServices
void * runtimeServices
Definition
boot_info.h:104
boot_info_t::disk
boot_disk_t disk
Definition
boot_info.h:105
boot_info_t::gop
boot_gop_t gop
Definition
boot_info.h:102
boot_info_t::rsdp
void * rsdp
Definition
boot_info.h:103
boot_info_t::kernel
boot_kernel_t kernel
Definition
boot_info.h:106
boot_kernel_t
Definition
boot_info.h:79
boot_kernel_t::symbols
elf_sym_t * symbols
Definition
boot_info.h:84
boot_kernel_t::virtStart
uintptr_t virtStart
Definition
boot_info.h:89
boot_kernel_t::phdrs
elf_phdr_t * phdrs
Definition
boot_info.h:81
boot_kernel_t::stringTable
char * stringTable
Definition
boot_info.h:86
boot_kernel_t::stringTableSize
uint64_t stringTableSize
Definition
boot_info.h:87
boot_kernel_t::header
elf_hdr_t header
Definition
boot_info.h:80
boot_kernel_t::symbolCount
uint32_t symbolCount
Definition
boot_info.h:85
boot_kernel_t::physStart
uintptr_t physStart
Definition
boot_info.h:88
boot_kernel_t::shdrs
elf_shdr_t * shdrs
Definition
boot_info.h:82
boot_kernel_t::size
uint64_t size
Definition
boot_info.h:91
boot_kernel_t::shdrCount
uint32_t shdrCount
Definition
boot_info.h:83
boot_memory_map_t
Definition
boot_info.h:45
boot_memory_map_t::key
UINTN key
Definition
boot_info.h:50
boot_memory_map_t::length
uint64_t length
Definition
boot_info.h:47
boot_memory_map_t::descVersion
UINT32 descVersion
Definition
boot_info.h:49
boot_memory_map_t::descriptors
EFI_MEMORY_DESCRIPTOR * descriptors
Definition
boot_info.h:46
boot_memory_map_t::descSize
UINTN descSize
Definition
boot_info.h:48
boot_memory_t
Definition
boot_info.h:95
boot_memory_t::table
page_table_t table
Definition
boot_info.h:97
boot_memory_t::map
boot_memory_map_t map
Definition
boot_info.h:96
elf_hdr_t
ELF file header.
Definition
elf.h:276
elf_phdr_t
ELF program header.
Definition
elf.h:299
elf_shdr_t
ELF section header.
Definition
elf.h:316
elf_sym_t
ELF symbol table entry.
Definition
elf.h:335
list_entry_t
A entry in a doubly linked list.
Definition
list.h:38
list_t
A doubly linked list.
Definition
list.h:51
page_table_t
A page table structure.
Definition
paging_types.h:379
include
boot
boot_info.h
Generated by
1.9.8