diff options
author | Anton Kling <anton@kling.gg> | 2024-02-14 17:40:06 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-02-14 17:40:06 +0100 |
commit | 3922adcdec5bd003b4106ffce79c28553bc40c15 (patch) | |
tree | f1af360cd7ad75d4b5f19bf066bf7e29ce8e3e53 /kernel/syscalls/install_irq.c | |
parent | a8ffc46136eb16adc87fb520c724467d1295a854 (diff) |
Kernel: Update signal handling and IPC
Diffstat (limited to 'kernel/syscalls/install_irq.c')
-rw-r--r-- | kernel/syscalls/install_irq.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/kernel/syscalls/install_irq.c b/kernel/syscalls/install_irq.c new file mode 100644 index 0000000..c50c6e0 --- /dev/null +++ b/kernel/syscalls/install_irq.c @@ -0,0 +1,26 @@ +#include <sched/scheduler.h> +#include <syscalls.h> + +process_t *tmp; +void *handler; + +void jump_signal_handler(void *func, u32 esp); + +void test_handler(reg_t *regs) { + kprintf("IRQ FIRED\n"); + kprintf("handler: %x\n", handler); + tmp->interrupt_handler = handler; + signal_t sig; + sig.handler_ip = (uintptr_t)handler; + process_push_signal(tmp, sig); + return; +} + +int syscall_install_irq(void (*irq_handler)(), u8 irq) { + // TODO: This should be able to fail if the handler is already set + tmp = get_current_task(); + handler = irq_handler; + kprintf("IRQ INSTALLED\n"); + install_handler(test_handler, INT_32_INTERRUPT_GATE(0x0), 0x20 + irq); + return 1; +} |