aboutsummaryrefslogtreecommitdiff
path: root/kernel/features/syscall.c
diff options
context:
space:
mode:
authorMarvin Borner2020-08-09 21:55:42 +0200
committerMarvin Borner2020-08-09 21:55:42 +0200
commitf163a5d5f6802f63092229f0f9326e5fb44b7908 (patch)
treef24ccfe1b9bd340875d534e1aa19ef8676fd4d7b /kernel/features/syscall.c
parentb6d3d341c19440f8447d8d6c6567b7ff78db3174 (diff)
Added malloc/free syscall
Diffstat (limited to 'kernel/features/syscall.c')
-rw-r--r--kernel/features/syscall.c12
1 files changed, 10 insertions, 2 deletions
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;
}