diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/features/mm.c | 6 | ||||
-rw-r--r-- | kernel/features/proc.c | 1 | ||||
-rw-r--r-- | kernel/features/syscall.c | 8 |
3 files changed, 6 insertions, 9 deletions
diff --git a/kernel/features/mm.c b/kernel/features/mm.c index 5fe70fd..b5fd33c 100644 --- a/kernel/features/mm.c +++ b/kernel/features/mm.c @@ -448,8 +448,6 @@ static struct memory_range kernel_memory_range(void) void memory_install(struct mem_info *mem_info) { - heap_init(HEAP_START); - for (struct mmap_boot *p = mem_info->start; (u32)(p - mem_info->start) < mem_info->size; p++) { if (p->hbase || !p->acpi || !p->type) @@ -486,10 +484,6 @@ void memory_install(struct mem_info *mem_info) memory_map_identity(&kernel_dir, memory_range_around(STACK_START - STACK_SIZE, STACK_SIZE), MEMORY_NONE); - // Map kernel heap - memory_map_identity(&kernel_dir, memory_range_around(HEAP_START, HEAP_INIT_SIZE), - MEMORY_NONE); - // TODO: Triple fault prevention? Probably bootloader stuff or something memory_map_identity(&kernel_dir, memory_range_around(0x7000, 0x1000), MEMORY_NONE); diff --git a/kernel/features/proc.c b/kernel/features/proc.c index e4b5105..e7ddf4b 100644 --- a/kernel/features/proc.c +++ b/kernel/features/proc.c @@ -487,6 +487,7 @@ void proc_init(void) struct node *new = list_add(proc_list, proc_make(PROC_PRIV_ROOT)); bin_load("/bin/init", new->data); current = new; + proc_stack_push(new->data, 0); _eip = ((struct proc *)new->data)->regs.eip; _esp = ((struct proc *)new->data)->regs.useresp; diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c index bac1738..486da6c 100644 --- a/kernel/features/syscall.c +++ b/kernel/features/syscall.c @@ -5,6 +5,7 @@ #include <interrupts.h> #include <load.h> #include <mem.h> +#include <mm.h> #include <net.h> #include <print.h> #include <proc.h> @@ -25,12 +26,13 @@ static void syscall_handler(struct regs *r) loop(); break; } - case SYS_MALLOC: { - r->eax = (u32)malloc(r->ebx); + case SYS_ALLOC: { + r->eax = (u32)memory_alloc(proc_current()->page_dir, r->ebx, + MEMORY_CLEAR | MEMORY_USER); break; } case SYS_FREE: { - free((void *)r->ebx); + memory_free(proc_current()->page_dir, memory_range(r->ebx, r->ecx)); break; } case SYS_STAT: { |