mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-26 15:26:43 +00:00
Add UEFI/BIOS boot detection in ZealBooter, pass to Zeal CKernel as new field.
This commit is contained in:
parent
df419bc641
commit
dac6f9efe1
4 changed files with 17 additions and 0 deletions
|
@ -62,6 +62,8 @@ SYS_DISK_UUID:: DU64 0, 0;
|
||||||
|
|
||||||
SYS_BOOT_STACK:: DU32 BOOT_RAM_LIMIT;
|
SYS_BOOT_STACK:: DU32 BOOT_RAM_LIMIT;
|
||||||
|
|
||||||
|
SYS_IS_UEFI_BOOTED:: DU8 0;
|
||||||
|
|
||||||
#assert $$ - SYS_KERNEL == sizeof(CKernel) - sizeof(CZXE)
|
#assert $$ - SYS_KERNEL == sizeof(CKernel) - sizeof(CZXE)
|
||||||
|
|
||||||
REQUESTED_SCREEN_WIDTH: DU16 1024;
|
REQUESTED_SCREEN_WIDTH: DU16 1024;
|
||||||
|
|
|
@ -564,6 +564,7 @@ class CKernel
|
||||||
U64 sys_smbios_entry;
|
U64 sys_smbios_entry;
|
||||||
U64 sys_disk_uuid[2];
|
U64 sys_disk_uuid[2];
|
||||||
U32 sys_boot_stack;
|
U32 sys_boot_stack;
|
||||||
|
Bool sys_is_uefi_booted;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Run-Levels
|
//Run-Levels
|
||||||
|
|
|
@ -253,6 +253,8 @@ public _extern SYS_FRAMEBUFFER_BPP U8 sys_framebuffer_bpp;
|
||||||
#help_index "Processor/SMBIOS"
|
#help_index "Processor/SMBIOS"
|
||||||
public _extern SYS_SMBIOS_ENTRY U8 *sys_smbios_entry;
|
public _extern SYS_SMBIOS_ENTRY U8 *sys_smbios_entry;
|
||||||
|
|
||||||
|
#help_index ""
|
||||||
public _extern SYS_DISK_UUID U64 sys_disk_uuid[2];
|
public _extern SYS_DISK_UUID U64 sys_disk_uuid[2];
|
||||||
|
public _extern SYS_IS_UEFI_BOOTED Bool sys_is_uefi_booted;
|
||||||
|
|
||||||
#help_index ""
|
#help_index ""
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <limine.h>
|
#include <limine.h>
|
||||||
#include <lib.h>
|
#include <lib.h>
|
||||||
|
|
||||||
|
@ -28,6 +29,11 @@ static volatile struct limine_smbios_request smbios_request = {
|
||||||
.revision = 0
|
.revision = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static volatile struct limine_efi_system_table_request efi_request = {
|
||||||
|
.id = LIMINE_EFI_SYSTEM_TABLE_REQUEST,
|
||||||
|
.revision = 0
|
||||||
|
};
|
||||||
|
|
||||||
struct CZXE {
|
struct CZXE {
|
||||||
uint16_t jmp;
|
uint16_t jmp;
|
||||||
uint8_t module_align_bits;
|
uint8_t module_align_bits;
|
||||||
|
@ -109,6 +115,7 @@ struct CKernel {
|
||||||
uint16_t sys_disk_uuid_c;
|
uint16_t sys_disk_uuid_c;
|
||||||
uint8_t sys_disk_uuid_d[8];
|
uint8_t sys_disk_uuid_d[8];
|
||||||
uint32_t sys_boot_stack;
|
uint32_t sys_boot_stack;
|
||||||
|
uint8_t sys_is_uefi_booted;
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
#define BOOT_SRC_RAM 2
|
#define BOOT_SRC_RAM 2
|
||||||
|
@ -320,6 +327,11 @@ void _start(void) {
|
||||||
|
|
||||||
kernel->sys_boot_stack = boot_stack;
|
kernel->sys_boot_stack = boot_stack;
|
||||||
|
|
||||||
|
if (efi_request.response)
|
||||||
|
{
|
||||||
|
kernel->sys_is_uefi_booted = true;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(trampoline_phys, trampoline, trampoline_size);
|
memcpy(trampoline_phys, trampoline, trampoline_size);
|
||||||
memcpy((void *)final_address, kernel, module_kernel->size);
|
memcpy((void *)final_address, kernel, module_kernel->size);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue