swissChili | 6422869 | 2021-03-16 08:19:23 -0700 | [diff] [blame] | 1 | #include "syscall.h" |
| 2 | #include "log.h" |
| 3 | #include "pic.h" |
swissChili | 52a03d8 | 2021-07-18 15:22:14 -0700 | [diff] [blame] | 4 | #include "task.h" |
| 5 | |
| 6 | #include <sys.h> |
swissChili | 6422869 | 2021-03-16 08:19:23 -0700 | [diff] [blame] | 7 | |
| 8 | void do_syscall(struct registers *regs) |
| 9 | { |
swissChili | 52a03d8 | 2021-07-18 15:22:14 -0700 | [diff] [blame] | 10 | switch (regs->eax) |
| 11 | { |
| 12 | case SYS_GIVEUP: |
| 13 | // easy, just switch tasks |
| 14 | switch_task(); |
| 15 | break; |
| 16 | |
| 17 | default: |
| 18 | kprintf(INFO "Syscall executed: %d\n", regs->eax); |
| 19 | } |
swissChili | 6422869 | 2021-03-16 08:19:23 -0700 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | void init_syscall() |
| 23 | { |
| 24 | add_interrupt_handler(SYSCALL_INT, do_syscall); |
| 25 | } |