diff options
author | Marvin Borner | 2020-08-09 18:50:17 +0200 |
---|---|---|
committer | Marvin Borner | 2020-08-09 18:50:17 +0200 |
commit | b933a9955a2a1eb0ab32b232e23d24dc207cba46 (patch) | |
tree | cb5871cb861a1e7eee8900a2ed81a9e33a3ce130 /kernel/features/syscall.c | |
parent | 544acef0986977ef9d3a05d87bb9f55163b1280a (diff) |
Added syscall templates
Diffstat (limited to 'kernel/features/syscall.c')
-rw-r--r-- | kernel/features/syscall.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c index 3d012cf..1a43b9e 100644 --- a/kernel/features/syscall.c +++ b/kernel/features/syscall.c @@ -6,16 +6,33 @@ #include <print.h> #include <proc.h> #include <str.h> +#include <sys.h> int i = 0; void syscall_handler(struct regs *r) { - printf("[SYSCALL] %d\n", r->eax); + enum sys num = r->eax; + printf("[SYSCALL] %d\n", num); - struct proc *a = proc_make(); - bin_load(++i ? "/a" : "/b", a); - strcpy(a->name, "a"); - proc_print(); + switch (num) { + case SYS_HALT: { + loop(); + break; + } + case SYS_EXEC: { + char *path = (char *)r->ebx; + struct proc *proc = proc_make(); + bin_load(path, proc); + strcpy(proc->name, path); + proc_print(); + break; + } + default: { + printf("Unknown syscall!\n"); + loop(); + break; + } + } } void syscall_init() |