boot: Add EFISTUB and refactor boot protocols
This commit is contained in:
+1
-13
@@ -2,6 +2,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <zinnia/boot.h>
|
||||
#include <zinnia/errno.h>
|
||||
#include <zinnia/initgraph.h>
|
||||
#include <zinnia/types.h>
|
||||
@@ -14,19 +15,6 @@ enum alloc_flags {
|
||||
ALLOC_MEM20 = 1 << 2, // Allocated memory needs to fit inside 20 bits.
|
||||
};
|
||||
|
||||
enum phys_mem_usage {
|
||||
PHYS_RESERVED,
|
||||
PHYS_USABLE,
|
||||
PHYS_STATIC,
|
||||
PHYS_RECLAIMABLE,
|
||||
};
|
||||
|
||||
struct phys_mem {
|
||||
phys_t address;
|
||||
size_t length;
|
||||
enum phys_mem_usage usage;
|
||||
};
|
||||
|
||||
// Base address of the HHDM.
|
||||
extern uintptr_t mem_hhdm_base;
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
// SPDX-License-Identifier: ISC
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <bits/types.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
enum phys_mem_usage {
|
||||
PHYS_RESERVED,
|
||||
PHYS_USABLE,
|
||||
PHYS_STATIC,
|
||||
PHYS_RECLAIMABLE,
|
||||
};
|
||||
|
||||
struct phys_mem {
|
||||
phys_t address;
|
||||
size_t length;
|
||||
enum phys_mem_usage usage;
|
||||
};
|
||||
|
||||
constexpr size_t BOOT_PATH_MAX = 128;
|
||||
|
||||
struct boot_file {
|
||||
phys_t data;
|
||||
size_t length;
|
||||
char path[BOOT_PATH_MAX];
|
||||
};
|
||||
|
||||
struct boot_color {
|
||||
uint8_t shift, size;
|
||||
};
|
||||
|
||||
struct boot_framebuffer {
|
||||
phys_t base;
|
||||
size_t width, height, pitch;
|
||||
uint8_t bytes_per_pixel;
|
||||
struct boot_color red, green, blue;
|
||||
};
|
||||
|
||||
constexpr size_t BOOT_LOADER_NAME_MAX = 64;
|
||||
constexpr size_t BOOT_CMDLINE_MAX = 4096;
|
||||
constexpr size_t BOOT_MEM_MAP_MAX = 128;
|
||||
constexpr size_t BOOT_FILES_MAX = 8;
|
||||
|
||||
struct boot_info {
|
||||
char loader[BOOT_LOADER_NAME_MAX];
|
||||
char cmdline[BOOT_CMDLINE_MAX];
|
||||
struct phys_mem mem_map[BOOT_MEM_MAP_MAX];
|
||||
size_t num_mem_maps;
|
||||
phys_t phys_base;
|
||||
uintptr_t virt_base;
|
||||
uintptr_t hhdm_base;
|
||||
struct boot_file files[BOOT_FILES_MAX];
|
||||
size_t num_files;
|
||||
struct boot_framebuffer fb;
|
||||
phys_t dtb;
|
||||
size_t dtb_size;
|
||||
phys_t rsdp;
|
||||
};
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <zinnia/errno.h>
|
||||
#include <zinnia/vfs.h>
|
||||
#include <arch/elf.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -84,6 +82,7 @@ enum : uint32_t {
|
||||
PT_MOD_CMDLINE = 0x60000005,
|
||||
PT_MOD_EXIT = 0x60000006,
|
||||
PT_MOD_MATCH = 0x60000007,
|
||||
PT_BOOT_INFO = 0x60000008,
|
||||
};
|
||||
|
||||
enum : uint16_t {
|
||||
|
||||
+2
-34
@@ -2,6 +2,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <zinnia/boot.h>
|
||||
#include <zinnia/compiler.h>
|
||||
#include <zinnia/types.h>
|
||||
#include <zinnia/utils.h>
|
||||
@@ -13,40 +14,7 @@
|
||||
#define __initdata __used, __section(".init.data")
|
||||
#define __initdata_sorted(name) __used, __section(".init.data." name)
|
||||
|
||||
struct boot_file {
|
||||
phys_t data;
|
||||
size_t length;
|
||||
char path[128];
|
||||
};
|
||||
|
||||
struct boot_color {
|
||||
uint8_t shift, size;
|
||||
};
|
||||
|
||||
struct boot_framebuffer {
|
||||
phys_t base;
|
||||
size_t width, height, pitch;
|
||||
uint8_t bytes_per_pixel;
|
||||
struct boot_color red, green, blue;
|
||||
};
|
||||
|
||||
struct boot_info {
|
||||
char* cmdline;
|
||||
struct phys_mem* mem_map;
|
||||
size_t num_mem_maps;
|
||||
phys_t phys_base;
|
||||
uintptr_t virt_base;
|
||||
uintptr_t hhdm_base;
|
||||
struct boot_file* files;
|
||||
size_t num_files;
|
||||
struct boot_framebuffer fb;
|
||||
struct boot_file kernel_file;
|
||||
phys_t dtb;
|
||||
size_t dtb_size;
|
||||
#if CONFIG_ACPI
|
||||
phys_t rsdp;
|
||||
#endif
|
||||
};
|
||||
extern struct boot_info boot_info;
|
||||
|
||||
[[__visibility("hidden")]]
|
||||
extern uint8_t __ld_stack_top[];
|
||||
|
||||
Reference in New Issue
Block a user