Unhardcode BOOT_RAM_LIMIT, patch via kernel headers.

This commit is contained in:
TomAwezome 2022-08-29 00:24:45 -04:00
parent 7a0c9a710c
commit 8fa30a396f
5 changed files with 8 additions and 2 deletions

View file

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

View file

@ -88,6 +88,7 @@ CORE0_32BIT_INIT:: //Entry point for $LK,"BootRAM",A="MN:BootRAM"$.
BTS U32 [SYS_RUN_LEVEL], RLf_32BIT
MOV ESI, U32 [SYS_BOOT_PATCH_TABLE_BASE]
MOV EDI, U32 [MEM_BOOT_BASE]
MOV ESP, U32 [SYS_BOOT_STACK]
MOV AX, CGDT.ds
MOV DS, AX
@ -95,7 +96,6 @@ CORE0_32BIT_INIT:: //Entry point for $LK,"BootRAM",A="MN:BootRAM"$.
MOV FS, AX
MOV GS, AX
MOV SS, AX
MOV ESP, BOOT_RAM_LIMIT //Tmp Stack
JMP @@02

View file

@ -83,7 +83,7 @@ USE64
//************************************
SYS_RAM_REBOOT:: //This gets copied high. $LK,"SYS_RAM_REBOOT",A="FF:::/System/Boot/BootRAM.ZC,SYS_RAM_REBOOT:2"$
PUSH U32 CGDT.ds //stack seg
PUSH U32 BOOT_RAM_LIMIT //stack
PUSH U32 [SYS_BOOT_STACK]//stack
PUSH U32 0 //flags
PUSH U32 CGDT.cs32
LEA RAX, [@@10]

View file

@ -563,6 +563,7 @@ class CKernel
U8 sys_framebuffer_bpp;
U64 sys_smbios_entry;
U64 sys_disk_uuid[2];
U32 sys_boot_stack;
};
//Run-Levels

View file

@ -111,6 +111,7 @@ struct CKernel {
uint16_t sys_disk_uuid_b;
uint16_t sys_disk_uuid_c;
uint8_t sys_disk_uuid_d[8];
uint32_t sys_boot_stack;
} __attribute__((packed));
#define BOOT_SRC_RAM 2
@ -266,6 +267,8 @@ void _start(void) {
uintptr_t boot_stack = ALIGN_UP(final_address + kernel->size + trampoline_size, 16) + boot_stack_size;
CKernel->sys_boot_stack = boot_stack;
memcpy(trampoline_phys, trampoline, trampoline_size);
memcpy((void *)final_address, CKernel, kernel->size);