diff options
author | Ian McFarlane <i.mcfarlane2002@gmail.com> | 2025-04-25 11:51:09 -0400 |
---|---|---|
committer | Ian McFarlane <i.mcfarlane2002@gmail.com> | 2025-04-25 11:51:09 -0400 |
commit | 25359ed1cb1a6131e9d3d26c8f2c8634670ed864 (patch) | |
tree | 559750220ff5084e33a2e1f5bc4f0c90b959a4f8 /kernel/cpu | |
parent | fix freeing of virtual memory (diff) | |
parent | poweroff syscall (diff) | |
download | comus-25359ed1cb1a6131e9d3d26c8f2c8634670ed864.tar.gz comus-25359ed1cb1a6131e9d3d26c8f2c8634670ed864.tar.bz2 comus-25359ed1cb1a6131e9d3d26c8f2c8634670ed864.zip |
resolve format conflict
Diffstat (limited to 'kernel/cpu')
-rw-r--r-- | kernel/cpu/idt.S | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/kernel/cpu/idt.S b/kernel/cpu/idt.S index 177d3b1..06c70a0 100644 --- a/kernel/cpu/idt.S +++ b/kernel/cpu/idt.S @@ -1,5 +1,5 @@ .global isr_stub_table - .global isr_restore + .global syscall_return .global awd .extern idt_exception_handler @@ -8,6 +8,7 @@ .extern idt_pic_mouse .extern idt_pic_eoi .extern syscall_handler + .extern current_pcb .macro PUSHALL pushq %rax @@ -88,7 +89,7 @@ isr_stub_\num: cld movq %rsp, %rdi # top of stack callq syscall_handler - jmp isr_restore + jmp syscall_return .endm .macro PICGeneric num @@ -419,12 +420,18 @@ isr_stub_table: .code64 # isr restore -isr_restore: - movw $(0x20 | 3), %ax - movw %ax, %ds - movw %ax, %es - movw %ax, %fs - movw %ax, %gs +syscall_return: + movq current_pcb, %rbx // return user stack + movq 0(%rbx), %rsp // esp + movq 8(%rbx), %rcx // pml4 + movq (%rcx), %rcx + movq %rcx, %cr3 + + movw $(0x20 | 3), %ax + movw %ax, %ds + movw %ax, %es + movw %ax, %fs + movw %ax, %gs POPALL iretq |