Add UEFI/BIOS boot detection in ZealBooter, pass to Zeal CKernel as new field.

This commit is contained in:
TomAwezome 2022-10-11 16:12:45 -04:00
parent df419bc641
commit dac6f9efe1
4 changed files with 17 additions and 0 deletions

View file

@ -62,6 +62,8 @@ SYS_DISK_UUID:: DU64 0, 0;
SYS_BOOT_STACK:: DU32 BOOT_RAM_LIMIT;
SYS_IS_UEFI_BOOTED:: DU8 0;
#assert $$ - SYS_KERNEL == sizeof(CKernel) - sizeof(CZXE)
REQUESTED_SCREEN_WIDTH: DU16 1024;

View file

@ -564,6 +564,7 @@ class CKernel
U64 sys_smbios_entry;
U64 sys_disk_uuid[2];
U32 sys_boot_stack;
Bool sys_is_uefi_booted;
};
//Run-Levels

View file

@ -253,6 +253,8 @@ public _extern SYS_FRAMEBUFFER_BPP U8 sys_framebuffer_bpp;
#help_index "Processor/SMBIOS"
public _extern SYS_SMBIOS_ENTRY U8 *sys_smbios_entry;
#help_index ""
public _extern SYS_DISK_UUID U64 sys_disk_uuid[2];
public _extern SYS_IS_UEFI_BOOTED Bool sys_is_uefi_booted;
#help_index ""

View file

@ -1,5 +1,6 @@
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <limine.h>
#include <lib.h>
@ -28,6 +29,11 @@ static volatile struct limine_smbios_request smbios_request = {
.revision = 0
};
static volatile struct limine_efi_system_table_request efi_request = {
.id = LIMINE_EFI_SYSTEM_TABLE_REQUEST,
.revision = 0
};
struct CZXE {
uint16_t jmp;
uint8_t module_align_bits;
@ -109,6 +115,7 @@ struct CKernel {
uint16_t sys_disk_uuid_c;
uint8_t sys_disk_uuid_d[8];
uint32_t sys_boot_stack;
uint8_t sys_is_uefi_booted;
} __attribute__((packed));
#define BOOT_SRC_RAM 2
@ -320,6 +327,11 @@ void _start(void) {
kernel->sys_boot_stack = boot_stack;
if (efi_request.response)
{
kernel->sys_is_uefi_booted = true;
}
memcpy(trampoline_phys, trampoline, trampoline_size);
memcpy((void *)final_address, kernel, module_kernel->size);