Kernel: Write isr handler for x86_32 and cleanup x86_64

This commit is contained in:
2024-03-26 16:36:51 +02:00
parent 1943c3e7a1
commit d7bf34ecd0
3 changed files with 97 additions and 43 deletions

View File

@@ -1,11 +1,11 @@
.macro pushaq
pushq %rax
pushq %rbx
pushq %rcx
pushq %rdx
pushq %rbx
pushq %rbp
pushq %rdi
pushq %rsi
pushq %rdi
pushq %r8
pushq %r9
pushq %r10
@@ -25,12 +25,12 @@
popq %r10
popq %r9
popq %r8
popq %rsi
popq %rdi
popq %rsi
popq %rbp
popq %rbx
popq %rdx
popq %rcx
popq %rbx
popq %rax
.endm
@@ -43,35 +43,29 @@
popq %r10
popq %r9
popq %r8
popq %rsi
popq %rdi
popq %rsi
popq %rbp
popq %rbx
popq %rdx
popq %rcx
popq %rbx
.endm
isr_stub:
pushaq
movq %cr0, %rax; pushq %rax
movq %cr2, %rax; pushq %rax
movq %cr3, %rax; pushq %rax
movq %cr4, %rax; pushq %rax
movq 184(%rsp), %rax; pushq %rax
movq 176(%rsp), %rax; pushq %rax
movq 208(%rsp), %rax; pushq %rax
movq 176(%rsp), %rdi
movq 184(%rsp), %rsi
movq %rsp, %rdx
addq $192, %rdx
movq %rsp, %rcx
movq %cr0, %rax; pushq %rax
movq %cr2, %rax; pushq %rax
movq %cr3, %rax; pushq %rax
movq %cr4, %rax; pushq %rax
movq 152(%rsp), %rdi // isr number
movq 160(%rsp), %rsi // error code
leaq 168(%rsp), %rdx // interrupt stack ptr
movq %rsp, %rcx // register ptr
call cpp_isr_handler
addq $56, %rsp
addq $32, %rsp
popaq
addq $16, %rsp
iretq