diff options
Diffstat (limited to 'kernel/features')
-rw-r--r-- | kernel/features/load.c | 4 | ||||
-rw-r--r-- | kernel/features/proc.c | 1 | ||||
-rw-r--r-- | kernel/features/syscall.c | 12 |
3 files changed, 12 insertions, 5 deletions
diff --git a/kernel/features/load.c b/kernel/features/load.c index cc1a094..14a3086 100644 --- a/kernel/features/load.c +++ b/kernel/features/load.c @@ -2,10 +2,9 @@ #include <def.h> #include <fs.h> -#include <load.h> #include <mem.h> -#include <print.h> #include <proc.h> +#include <str.h> void bin_load(char *path, struct proc *proc) { @@ -16,4 +15,5 @@ void bin_load(char *path, struct proc *proc) proc->regs.esp = (u32)stack; proc->regs.useresp = (u32)stack; proc->regs.eip = (u32)data; + strcpy(proc->name, path + 1); } diff --git a/kernel/features/proc.c b/kernel/features/proc.c index a14aaea..64a4ac1 100644 --- a/kernel/features/proc.c +++ b/kernel/features/proc.c @@ -95,7 +95,6 @@ void proc_init() root = proc_make(); bin_load("/init", root); - strcpy(root->name, "root"); proc_print(); _eip = root->regs.eip; diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c index 1a43b9e..eaa09b3 100644 --- a/kernel/features/syscall.c +++ b/kernel/features/syscall.c @@ -3,6 +3,7 @@ #include <cpu.h> #include <interrupts.h> #include <load.h> +#include <mem.h> #include <print.h> #include <proc.h> #include <str.h> @@ -15,15 +16,22 @@ void syscall_handler(struct regs *r) printf("[SYSCALL] %d\n", num); switch (num) { - case SYS_HALT: { + case SYS_LOOP: { loop(); break; } + case SYS_MALLOC: { + r->eax = (u32)malloc(r->eax); + break; + } + case SYS_FREE: { + free(r->eax); + 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; } |