summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex AUVOLAT <alexis211@gmail.com>2012-05-01 10:39:33 +0200
committerAlex AUVOLAT <alexis211@gmail.com>2012-05-01 10:39:33 +0200
commit66b32658d2e5aa99493dcb3abcb73cdb2cc6f0b5 (patch)
tree3b728f4c8dc93f6ab9237af3d32410346b617ae8
parent07b15b375ee7cc87f476200b2fd6205959ac0ba4 (diff)
downloadTCE-66b32658d2e5aa99493dcb3abcb73cdb2cc6f0b5.tar.gz
TCE-66b32658d2e5aa99493dcb3abcb73cdb2cc6f0b5.zip
It's alive! Or is it? No, it's not.
-rw-r--r--Makefile7
-rw-r--r--src/kernel/config.h2
-rw-r--r--src/kernel/core/test.c2
-rw-r--r--src/kernel/mem/heap.std.h2
-rw-r--r--src/modules/test/main.c22
5 files changed, 20 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index c83979c..1da4ce5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
.PHONY: clean, mrproper, Init.rfs, floppy, commit
Projects = kernel library modules/test
+QemuCmd = qemu-system-i386
Floppy = Grapes.fl.img
@@ -8,7 +9,7 @@ all:
@for p in $(Projects); do \
echo ""; echo "----------------------"; \
echo "=> Building $$p"; \
- make -C src/$$p -s; \
+ make -C src/$$p; \
done
rebuild: mrproper all
@@ -44,8 +45,8 @@ bochs: all floppy
bochs -f bochs.cfg
qemu: all floppy
- qemu -fda $(Floppy) -m 16
+ $(QemuCmd) -fda $(Floppy) -m 16
qemu-gdb: all floppy
- qemu -fda $(Floppy) -m 16 -s -S & gdb src/kernel/kernel.elf -x gdb-cmd
+ $(QemuCmd) -fda $(Floppy) -m 16 -s -S & gdb src/kernel/kernel.elf -x gdb-cmd
diff --git a/src/kernel/config.h b/src/kernel/config.h
index ccad9cf..38487dc 100644
--- a/src/kernel/config.h
+++ b/src/kernel/config.h
@@ -10,6 +10,6 @@
- Basic implementation, slow but bug-free
- Standard implementation, efficient, buggy, based on the heap code from JamesM's OSDev tutorial
Comment the following define to use the second version */
-#define K_USE_BASIC_HEAP
+// #define K_USE_BASIC_HEAP
#endif
diff --git a/src/kernel/core/test.c b/src/kernel/core/test.c
index 867a4b5..8f7b32c 100644
--- a/src/kernel/core/test.c
+++ b/src/kernel/core/test.c
@@ -8,7 +8,7 @@ static void test_run_kmalloc() {
int alloc_sizes[8] = { 10, 32, 16, 20, 64, 128, 32, 48 };
int *ptrs[8] = { 0 };
int t, i;
- for (t = 0; t < 2; t++) {
+ 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(" : ");
diff --git a/src/kernel/mem/heap.std.h b/src/kernel/mem/heap.std.h
index a7ba173..fa146ae 100644
--- a/src/kernel/mem/heap.std.h
+++ b/src/kernel/mem/heap.std.h
@@ -1,8 +1,6 @@
#ifndef DEF_HEAP_H
#define DEF_HEAP_H
-#error "Using standard heap ! It's all buggy everywhere !"
-
/* The heap is the data structure that permits allocating and freeing memory easily.
The functions in this file are only used by mem.c, which provides kmalloc and kfree.
The heap algorithm used is based on the one described here :
diff --git a/src/modules/test/main.c b/src/modules/test/main.c
index 26ff840..6c13e5a 100644
--- a/src/modules/test/main.c
+++ b/src/modules/test/main.c
@@ -6,27 +6,33 @@ void thread_cascade(void* d) {
int n = (int)d;
if (d == 0) {
- printk("{#} 0 cascade element started => end\n");
+ //printk("{#} 0 cascade element started => end\n");
+ printk("{#}0end\t");
} else {
if (n < 0) {
- printk("{#} - cascade element started\n");
+ //printk("{#} - cascade element started\n");
+ printk("{#}-\t");
n = 0 - n;
} else {
- printk("{#} + cascade element started\n");
+ //printk("{#} + cascade element started\n");
+ printk("{#}+\t");
}
- printk("{#} FORK + ...\n");
+ //printk("{#} FORK + ...\n");
+ printk("{#}F+\t");
thread_new(thread_cascade, (void*)(n - 1));
- printk("{#} FORK - ...\n");
+ //printk("{#} FORK - ...\n");
+ printk("{#}F-\t");
thread_new(thread_cascade, (void*)(1 - n));
- printk("{#} Thread cascade element finished.\n");
+ //printk("{#} Thread cascade element finished.\n");
+ printk("{#}end\t");
}
}
int main() {
printk("Hi world from test module !\n");
- printk("{1} Creating thread cascade len:1\n");
- thread_new(thread_cascade, (void*)1);
+ printk("{1} Creating thread cascade len:5\n");
+ thread_new(thread_cascade, (void*)5);
printk("{1} Thread now sleeping...\n");
while (1) thread_sleep(1000);