From 06121c7075e91056820c674f192be460ef5eb656 Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Sat, 15 Jan 2022 16:24:08 -0600 Subject: arch: i386: add support for IRQs and system calls Add support for rudementary system calls and IRQ interrupts. Signed-off-by: Danny Holman --- arch/i386/boot/syscall.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 arch/i386/boot/syscall.c (limited to 'arch/i386/boot/syscall.c') diff --git a/arch/i386/boot/syscall.c b/arch/i386/boot/syscall.c new file mode 100644 index 0000000..fb613b3 --- /dev/null +++ b/arch/i386/boot/syscall.c @@ -0,0 +1,21 @@ +#include "syscall.h" +#include +#include + +void *(*syscall_handlers[30])(struct isr_frame *frame); + +void syscall_dispatch(struct isr_frame *frame) { + if (syscall_handlers[frame->eax] != NULL) + syscall_handlers[frame->eax](frame); + else + kprintf("Error: Invalid system call number: %d\n", frame->eax); + __asm__ volatile("cli;hlt"); +} + +void register_syscall(void *handler(struct isr_frame*), int num) { + syscall_handlers[num] = handler; +} + +void print_hello(struct isr_frame *frame) { + kprintf("Hello syscall\n"); +} -- cgit v1.2.3