From 2dadbfc899df4179ca70c4ea04f74a5e190c2ae7 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Fri, 26 Sep 2025 13:17:41 -0400 Subject: fix usermode interrupts. add ability to define custom interrupt handlers --- arch/x86_64/syscall/syscall.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'arch/x86_64/syscall/syscall.c') diff --git a/arch/x86_64/syscall/syscall.c b/arch/x86_64/syscall/syscall.c index 7ddd179..1ed991d 100644 --- a/arch/x86_64/syscall/syscall.c +++ b/arch/x86_64/syscall/syscall.c @@ -35,18 +35,36 @@ __attribute__((naked)) void _syscall_entry(void) { __asm__ volatile(" \ - pushq %%r11; \ - pushq %%rcx; \ swapgs; \ movq %%gs:%c[tcb], %%rax; \ movq %%rsp, %c[sp](%%rax); \ movq %c[ksp](%%rax), %%rsp; \ pushq %c[sp](%%rax); \ + pushq %%r11; \ + pushq %%rcx; \ + pushq %%rbx; \ + pushq %%rbp; \ + pushq %%r12; \ + pushq %%r13; \ + pushq %%r14; \ + pushq %%r15; \ callq _syscall_handler; \ swapgs; \ - popq %%rsp; \ + popq %%r15; \ + popq %%r14; \ + popq %%r13; \ + popq %%r12; \ + popq %%rbp; \ + popq %%rbx; \ + xorq %%rdx, %%rdx; \ + xorq %%rsi, %%rsi; \ + xorq %%rdi, %%rdi; \ + xorq %%r8, %%r8; \ + xorq %%r9, %%r9; \ + xorq %%r10, %%r10; \ popq %%rcx; \ popq %%r11; \ + popq %%rsp; \ sysretq;" :: [tcb] "i"(offsetof(processor_t, tcb)), -- cgit v1.2.1