diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-01 17:42:36 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-01 17:42:36 +0200 |
commit | e9683297bf480f9590b0e5796f4520fb430e2e03 (patch) | |
tree | 93ef75cd154edf4c342d0a22cd56eb3670feb2b5 /src/kernel/core | |
parent | e8cf65c07d78e3cfbac953b1b97c51998a5900df (diff) | |
download | TCE-e9683297bf480f9590b0e5796f4520fb430e2e03.tar.gz TCE-e9683297bf480f9590b0e5796f4520fb430e2e03.zip |
Now using Doug Lea's malloc for userland too. And improved stability.
Diffstat (limited to 'src/kernel/core')
-rw-r--r-- | src/kernel/core/kmain.c | 7 | ||||
-rw-r--r-- | src/kernel/core/sys.c | 3 | ||||
-rw-r--r-- | src/kernel/core/test.c | 37 | ||||
-rw-r--r-- | src/kernel/core/test.h | 6 |
4 files changed, 4 insertions, 49 deletions
diff --git a/src/kernel/core/kmain.c b/src/kernel/core/kmain.c index 17c9425..8c36b54 100644 --- a/src/kernel/core/kmain.c +++ b/src/kernel/core/kmain.c @@ -4,7 +4,6 @@ #include "multiboot.h" #include "monitor.h" #include "sys.h" -#include "test.h" #include <task/idt.h> #include <task/timer.h> #include <task/task.h> @@ -56,8 +55,6 @@ void kmain(struct multiboot_info_t* mbd, int32_t magic) { //kheap_init(); timer_init(30); tasking_init(); - - //test_run(); monitor_write("\n\nLoading modules :\n"); for (i = 0; i < mbd->mods_count; i++) { @@ -66,7 +63,7 @@ void kmain(struct multiboot_info_t* mbd, int32_t magic) { if (elf_check((uint8_t*)mods[i].mod_start)) { monitor_write(" : Invalid ELF file\n"); } else { - struct process *pr = elf_exec((uint8_t*)mods[i].mod_start, PL_DRIVER); + struct process *pr = elf_exec((uint8_t*)mods[i].mod_start, PL_USER); if (pr == 0) { monitor_write(" : Error loading\n"); } else { @@ -77,6 +74,6 @@ void kmain(struct multiboot_info_t* mbd, int32_t magic) { monitor_write("Modules now RULE THE WORLD !\n\n"); sti(); - tasking_switch(); + schedule(); PANIC("Should never happen. Something probably went wrong with multitasking."); } diff --git a/src/kernel/core/sys.c b/src/kernel/core/sys.c index 4a88838..2c2372d 100644 --- a/src/kernel/core/sys.c +++ b/src/kernel/core/sys.c @@ -39,11 +39,12 @@ void stack_trace(size_t bp) { /* For internal use only. Used by panic and panic_assert. */ static void panic_do(char* file, int line) { + asm volatile("cli;"); monitor_write("\n File:\t\t"); monitor_write(file); monitor_put(':'); monitor_writeDec(line); monitor_write("\nTrace:\n"); size_t bp; asm volatile("mov %%ebp,%0" : "=r"(bp)); stack_trace(bp); monitor_write("\n\t\tSystem halted -_-'"); - asm volatile("cli; hlt"); + asm volatile("hlt"); } /* These functions stop the system, reporting an error message, because something bad happenned. */ diff --git a/src/kernel/core/test.c b/src/kernel/core/test.c deleted file mode 100644 index 8f7b32c..0000000 --- a/src/kernel/core/test.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "test.h" -#include "monitor.h" -#include <mem/mem.h> -#include "sys.h" - -static void test_run_kmalloc() { - monitor_write("\tkmalloc:\n"); - int alloc_sizes[8] = { 10, 32, 16, 20, 64, 128, 32, 48 }; - int *ptrs[8] = { 0 }; - int t, i; - for (t = 0; t < 4; t++) { - for (i = 0; i < 8; i++) { - monitor_writeDec(i); monitor_write(" alloc "); monitor_writeDec(alloc_sizes[i]); - monitor_write(" : "); - ptrs[i] = kmalloc(alloc_sizes[i]); - ASSERT(ptrs[i] != 0); - *ptrs[i] = i; - monitor_writeHex((int)ptrs[i]); monitor_write("\n"); - } - monitor_write("free : "); - for (i = 0; i < 8; i++) { - monitor_writeDec(i); - ASSERT(*ptrs[i] == i); - kfree(ptrs[i]); - monitor_write("."); - } - monitor_write("\n"); - } -} - -/* This function is called when the kernel starts up. - It runs some basic unit tests (for the moment, only tests kmalloc/kfree) */ -void test_run() { - monitor_write("Unit tests:\n"); - test_run_kmalloc(); - monitor_write(" >> Tests OK\n"); -} diff --git a/src/kernel/core/test.h b/src/kernel/core/test.h deleted file mode 100644 index ee689c6..0000000 --- a/src/kernel/core/test.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef DEF_TEST_H -#define DEF_TEST_H - -void test_run(); //run basic unit tests on kmalloc() and kfree() - -#endif |