feat(loader, kernel): impl part of loader and initialize kernel structure

This commit is contained in:
2026-04-11 09:42:09 +08:00
parent 1233ae9e9b
commit 34ccf69569
53 changed files with 1743 additions and 777 deletions

View File

@@ -0,0 +1,56 @@
.macro EXCEPTION_HANDLER name function error_code=0
.global \name
.type \name, @function
\name:
if \error_code == 0
pushq $0
end
pushq %rdi
pushq %rsi
pushq %rdx
pushq %rcx
pushq %rax
pushq %r8
pushq %r9
pushq %r10
pushq %r11
pushq %rbx
pushq %rbp
pushq %r12
pushq %r13
pushq %r14
pushq %r15
movq %rsp, %rdi
/* Error code is second parameter */
movq 120(%rsp), %rsi
call \function
/* Restore regs */
popq %r15
popq %r14
popq %r13
popq %r12
popq %rbp
popq %rbx
popq %r11
popq %r10
popq %r9
popq %r8
popq %rax
popq %rcx
popq %rdx
popq %rsi
popq %rdi
addq $8, %rsp
iretq
.endm
.text
.code64
EXCEPTION_HANDLER boot_page_fault doBootPageFault error_code=1
EXCEPTION_HANDLER boot_nmi doBootNMI