diff options
author | Freya Murphy <freya@freyacat.org> | 2025-04-24 12:38:51 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-04-24 12:38:51 -0400 |
commit | fb31d11331585a99a537f438f79b472074209c13 (patch) | |
tree | 08c6b40ee2caf0b5edc7ff544fa17cdea0448879 /kernel/cpu/idt.S | |
parent | const pointers on free & kmapuseraddr (diff) | |
download | comus-fb31d11331585a99a537f438f79b472074209c13.tar.gz comus-fb31d11331585a99a537f438f79b472074209c13.tar.bz2 comus-fb31d11331585a99a537f438f79b472074209c13.zip |
kernel syscall handler
Diffstat (limited to 'kernel/cpu/idt.S')
-rw-r--r-- | kernel/cpu/idt.S | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/kernel/cpu/idt.S b/kernel/cpu/idt.S index 0ba35f8..177d3b1 100644 --- a/kernel/cpu/idt.S +++ b/kernel/cpu/idt.S @@ -1,10 +1,13 @@ .global isr_stub_table + .global isr_restore + .global awd .extern idt_exception_handler .extern idt_pic_timer .extern idt_pic_keyboard .extern idt_pic_mouse .extern idt_pic_eoi + .extern syscall_handler .macro PUSHALL pushq %rax @@ -78,6 +81,16 @@ isr_stub_\num: iretq .endm +.macro SYSCALL num + .align 8 +isr_stub_\num: + PUSHALL + cld + movq %rsp, %rdi # top of stack + callq syscall_handler + jmp isr_restore +.endm + .macro PICGeneric num .align 8 isr_stub_\num: @@ -402,10 +415,21 @@ isr_stub_table: .quad isr_stub_254 .quad isr_stub_255 -# isr stubs .section .text .code64 +# isr restore +isr_restore: + movw $(0x20 | 3), %ax + movw %ax, %ds + movw %ax, %es + movw %ax, %fs + movw %ax, %gs + + POPALL + iretq + +# isr stubs ISRException 0 ISRException 1 ISRException 2 @@ -536,7 +560,7 @@ ISRIgnore 124 ISRIgnore 125 ISRIgnore 126 ISRIgnore 127 -ISRIgnore 128 +SYSCALL 128 ISRIgnore 129 ISRIgnore 130 ISRIgnore 131 |