diff options
| author | 2026-08-18 12:15:05 +0200 | |
|---|---|---|
| committer | 2026-08-18 12:15:05 +0200 | |
| commit | 132d3236bb884433bf94e961f6d32264e0334aec (patch) | |
| tree | 06638976b06f019ea4037175ff228f8271057c44 /kernel/loader.s | |
Diffstat (limited to 'kernel/loader.s')
| -rw-r--r-- | kernel/loader.s | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/kernel/loader.s b/kernel/loader.s new file mode 100644 index 0000000..791c231 --- /dev/null +++ b/kernel/loader.s @@ -0,0 +1,32 @@ +global loader +extern kmain + +section .text +align 4 +STACKSIZE equ 0x4000 + + +loader: + ;setup the stack and call the kernel entry point + ; shouldn't really use it this way, but take the loading address and move that to rsp to get a working stack + mov rsp, stack+STACKSIZE + mov rbp, rsp + + ; enable FPU, SSE + mov rax, cr0 + and ax, 0xFFFB + or ax, 0x2 + mov cr0, rax + mov rax, cr4 + or ax, 3 << 9 ; OSFXSR OSXMMEXCPT + mov cr4, rax + + ; pass arguments we receiver, or maybe have to get them first fropm the stack + call kmain + hlt + + +section .bss +align 32 +stack: + resb STACKSIZE |
