diff options
author | Danny Holman <dholman@gymli.org> | 2023-11-26 18:36:26 -0600 |
---|---|---|
committer | Danny Holman <dholman@gymli.org> | 2023-11-26 18:36:26 -0600 |
commit | 34ab1bd020ad5567955654ae5f0f8f0a10e62b1e (patch) | |
tree | 866b1f17287ed390a19c3f1d54c3153c0440ce9e /arch/i386/kernel | |
parent | a7a72efe2301eeedd0898f9a271fb4d514845f8a (diff) |
arch: i386: syscall.c: replace function calls with single switch
Replace individual function calls with a single switch-case structure
for system calls. The new function, handle_syscall, will construct and
call the interrupt without input from the programmer.
Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'arch/i386/kernel')
-rw-r--r-- | arch/i386/kernel/syscall.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/arch/i386/kernel/syscall.c b/arch/i386/kernel/syscall.c index 18f36ad..593bb64 100644 --- a/arch/i386/kernel/syscall.c +++ b/arch/i386/kernel/syscall.c @@ -2,27 +2,15 @@ #include <kernel/io.h> #include <stddef.h> -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); -} - -void register_syscall(void *handler(struct isr_frame*), int num) { - syscall_handlers[num] = handler; -} - -void sys_stop(struct isr_frame *frame) { - kprintf("SYSTEM CALL: STOP\n"); - halt_catch_fire(frame); -} - -void sys_status(struct isr_frame *frame) { - kprintf("SYSTEM CALL: STATUS\n"); - dump_reg(frame); +int handle_syscall(struct isr_frame *frame) { + switch (frame->eax) { + case SYS_REBOOT: + kprintf("REBOOT NOT SUPPORTED\n"); + break; + default: + kprintf("Error: Invalid system call number: %d\n", frame->eax); + } + return 0; } void dump_reg(struct isr_frame *frame) { |