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