mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-26 15:26:43 +00:00
Implement limine zealbooter prekernel SMBIOS entry patching to kernel.
This commit is contained in:
parent
dbbf751a44
commit
0bf82fb057
5 changed files with 21 additions and 0 deletions
|
@ -63,6 +63,8 @@ SYS_FRAMEBUFFER_HEIGHT:: DU64 0;
|
||||||
SYS_FRAMEBUFFER_PITCH:: DU64 0;
|
SYS_FRAMEBUFFER_PITCH:: DU64 0;
|
||||||
SYS_FRAMEBUFFER_BPP:: DU16 0;
|
SYS_FRAMEBUFFER_BPP:: DU16 0;
|
||||||
|
|
||||||
|
SYS_SMBIOS_ENTRY:: DU64 0;
|
||||||
|
|
||||||
#assert $$ - SYS_KERNEL == sizeof(CKernel) - sizeof(CZXE)
|
#assert $$ - SYS_KERNEL == sizeof(CKernel) - sizeof(CZXE)
|
||||||
|
|
||||||
TEMP_VBE_MODE: DU8 sizeof(CVBEMode) DUP(0);
|
TEMP_VBE_MODE: DU8 sizeof(CVBEMode) DUP(0);
|
||||||
|
|
|
@ -574,6 +574,7 @@ class CKernel
|
||||||
U64 sys_framebuffer_height;
|
U64 sys_framebuffer_height;
|
||||||
U64 sys_framebuffer_pitch;
|
U64 sys_framebuffer_pitch;
|
||||||
U16 sys_framebuffer_bpp;
|
U16 sys_framebuffer_bpp;
|
||||||
|
U64 sys_smbios_entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Run-Levels
|
//Run-Levels
|
||||||
|
|
|
@ -256,4 +256,7 @@ public _extern SYS_FRAMEBUFFER_HEIGHT U64 sys_framebuffer_height;
|
||||||
public _extern SYS_FRAMEBUFFER_PITCH U64 sys_framebuffer_pitch;
|
public _extern SYS_FRAMEBUFFER_PITCH U64 sys_framebuffer_pitch;
|
||||||
public _extern SYS_FRAMEBUFFER_BPP U16 sys_framebuffer_bpp;
|
public _extern SYS_FRAMEBUFFER_BPP U16 sys_framebuffer_bpp;
|
||||||
|
|
||||||
|
#help_index "Processor/SMBIOS"
|
||||||
|
public _extern SYS_SMBIOS_ENTRY U8 *sys_smbios_entry;
|
||||||
|
|
||||||
#help_index ""
|
#help_index ""
|
||||||
|
|
|
@ -660,6 +660,12 @@ Bool SMBIOSEntryScan(CSMBIOSEntryPoint **entry)
|
||||||
I64 i;
|
I64 i;
|
||||||
U8 noreg checksum = 0, *mem = 0xF0000;
|
U8 noreg checksum = 0, *mem = 0xF0000;
|
||||||
|
|
||||||
|
if (sys_smbios_entry)
|
||||||
|
{
|
||||||
|
*entry = sys_smbios_entry;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (!MemCompare(mem, "_SM_", 4))
|
if (!MemCompare(mem, "_SM_", 4))
|
||||||
|
|
|
@ -28,6 +28,11 @@ static volatile struct limine_framebuffer_request framebuffer_request = {
|
||||||
.revision = 0
|
.revision = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static volatile struct limine_smbios_request smbios_request = {
|
||||||
|
.id = LIMINE_SMBIOS_REQUEST,
|
||||||
|
.revision = 0
|
||||||
|
};
|
||||||
|
|
||||||
struct CZXE {
|
struct CZXE {
|
||||||
uint16_t jmp;
|
uint16_t jmp;
|
||||||
uint8_t module_align_bits;
|
uint8_t module_align_bits;
|
||||||
|
@ -136,6 +141,7 @@ struct CKernel {
|
||||||
uint64_t sys_framebuffer_height;
|
uint64_t sys_framebuffer_height;
|
||||||
uint64_t sys_framebuffer_pitch;
|
uint64_t sys_framebuffer_pitch;
|
||||||
uint16_t sys_framebuffer_bpp;
|
uint16_t sys_framebuffer_bpp;
|
||||||
|
uint64_t sys_smbios_entry;
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
#define BOOT_SRC_RAM 2
|
#define BOOT_SRC_RAM 2
|
||||||
|
@ -271,6 +277,9 @@ void _start(void) {
|
||||||
void *sys_gdt_ptr = (void *)&CKernel->sys_gdt_ptr - (uintptr_t)kernel->address;
|
void *sys_gdt_ptr = (void *)&CKernel->sys_gdt_ptr - (uintptr_t)kernel->address;
|
||||||
sys_gdt_ptr += final_address;
|
sys_gdt_ptr += final_address;
|
||||||
|
|
||||||
|
void *sys_smbios_entry = smbios_request.response->entry_32;
|
||||||
|
CKernel->sys_smbios_entry = (uintptr_t)sys_smbios_entry - hhdm_request.response->offset;
|
||||||
|
|
||||||
void *trampoline_phys = (void *)final_address + kernel->size;
|
void *trampoline_phys = (void *)final_address + kernel->size;
|
||||||
|
|
||||||
uintptr_t boot_stack = ALIGN_UP(final_address + kernel->size + trampoline_size, 16) + boot_stack_size;
|
uintptr_t boot_stack = ALIGN_UP(final_address + kernel->size + trampoline_size, 16) + boot_stack_size;
|
||||||
|
|
Loading…
Reference in a new issue