PatchworkOS
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
13static 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}
40
41#define BOOT_MEMORY_MAP_GET_DESCRIPTOR(map, index) \
42 (EFI_MEMORY_DESCRIPTOR*)((uint64_t)(map)->descriptors + ((index) * (map)->descSize))
43
44typedef struct
45{
46 EFI_MEMORY_DESCRIPTOR* descriptors;
48 UINTN descSize;
50 UINTN key;
52
53typedef struct boot_dir boot_dir_t;
54
55typedef struct boot_file
56{
58 char name[MAX_NAME];
59 void* data;
62
63typedef struct boot_dir
64{
66 char name[MAX_NAME];
70
71typedef struct boot_disk
72{
75
76typedef struct boot_info boot_info_t;
77
93
99
#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:13
__UINT32_TYPE__ uint32_t
Definition stdint.h:15
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:43
list_t files
Definition boot_info.h:68
list_t children
Definition boot_info.h:67
list_entry_t entry
Definition boot_info.h:65
boot_dir_t * root
Definition boot_info.h:73
list_entry_t entry
Definition boot_info.h:57
void * data
Definition boot_info.h:59
uint64_t size
Definition boot_info.h:60
uint32_t width
Definition boot_info.h:36
uint64_t size
Definition boot_info.h:35
uint32_t * virtAddr
Definition boot_info.h:34
uint32_t height
Definition boot_info.h:37
uint32_t * physAddr
Definition boot_info.h:33
uint32_t stride
Definition boot_info.h:38
boot_memory_t memory
Definition boot_info.h:107
void * runtimeServices
Definition boot_info.h:104
boot_disk_t disk
Definition boot_info.h:105
boot_gop_t gop
Definition boot_info.h:102
void * rsdp
Definition boot_info.h:103
boot_kernel_t kernel
Definition boot_info.h:106
elf_sym_t * symbols
Definition boot_info.h:84
uintptr_t virtStart
Definition boot_info.h:89
elf_phdr_t * phdrs
Definition boot_info.h:81
char * stringTable
Definition boot_info.h:86
uint64_t stringTableSize
Definition boot_info.h:87
elf_hdr_t header
Definition boot_info.h:80
uint32_t symbolCount
Definition boot_info.h:85
uintptr_t physStart
Definition boot_info.h:88
elf_shdr_t * shdrs
Definition boot_info.h:82
uint64_t size
Definition boot_info.h:91
uint32_t shdrCount
Definition boot_info.h:83
uint64_t length
Definition boot_info.h:47
EFI_MEMORY_DESCRIPTOR * descriptors
Definition boot_info.h:46
page_table_t table
Definition boot_info.h:97
boot_memory_map_t map
Definition boot_info.h:96
ELF file header.
Definition elf.h:276
ELF program header.
Definition elf.h:299
ELF section header.
Definition elf.h:316
ELF symbol table entry.
Definition elf.h:335
A entry in a doubly linked list.
Definition list.h:38
A doubly linked list.
Definition list.h:51
A page table structure.