diff options
author | Marvin Borner | 2020-08-21 20:39:48 +0200 |
---|---|---|
committer | Marvin Borner | 2020-08-21 20:39:48 +0200 |
commit | f700ba6668dbdb91a03b2c5aa387eb4cabae8fcd (patch) | |
tree | b04a80efabb09c9da9726332ccd22cb5a325fe39 /kernel/features/syscall.c | |
parent | 1339d96cea2c647991c178587008d6fc40772a78 (diff) |
Some things here and some things there
Diffstat (limited to 'kernel/features/syscall.c')
-rw-r--r-- | kernel/features/syscall.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c index 9d5ac82..02b17e5 100644 --- a/kernel/features/syscall.c +++ b/kernel/features/syscall.c @@ -15,53 +15,64 @@ void syscall_handler(struct regs *r) { enum sys num = r->eax; r->eax = 0; - printf("[SYSCALL] %d\n", num); + printf("[SYSCALL] %d: ", num); switch (num) { case SYS_LOOP: { + printf("loop\n"); loop(); break; } case SYS_MALLOC: { + printf("malloc\n"); r->eax = (u32)malloc(r->eax); break; } case SYS_FREE: { + printf("free\n"); free(r->eax); break; } case SYS_READ: { + printf("read\n"); r->eax = (u32)read_file((char *)r->ebx); break; } case SYS_WRITE: { + printf("write\n"); // TODO: Write ext2 support break; } case SYS_EXEC: { + printf("exec\n"); char *path = (char *)r->ebx; struct proc *proc = proc_make(); - ((u32 *)proc->regs.esp)[0] = r->ecx; - ((u32 *)proc->regs.esp)[1] = r->edx; - ((u32 *)proc->regs.esp)[2] = r->esi; - ((u32 *)proc->regs.esp)[3] = r->edi; + r->eax = bin_load(path, proc); + ((u32 *)proc->regs.useresp)[0] = 42; + ((char *)proc->regs.useresp)[1] = r->ecx; + ((char *)proc->regs.useresp)[2] = r->edx; + ((char *)proc->regs.useresp)[3] = r->esi; + ((char *)proc->regs.useresp)[4] = r->edi; break; } case SYS_EXIT: { - proc_exit(); + printf("exit\n"); + proc_exit(r->ebx); break; } case SYS_MAP: { + printf("map\n"); event_map(r->ebx, (u32 *)r->ecx); break; } case SYS_UNMAP: { + printf("unmap\n"); event_unmap(r->ebx, (u32 *)r->ecx); break; } default: { - printf("Unknown syscall!\n"); + printf("unknown\n"); loop(); break; } |