From 5cac9acd3aedc8043d4272d93c56805c46ff6214 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Tue, 1 May 2012 12:20:45 +0200 Subject: Some cleanup ; relocated the kernel at 0xC0000000 --- src/user/test/Makefile | 6 ++++++ src/user/test/main.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 src/user/test/Makefile create mode 100644 src/user/test/main.c (limited to 'src/user/test') diff --git a/src/user/test/Makefile b/src/user/test/Makefile new file mode 100644 index 0000000..5c8464a --- /dev/null +++ b/src/user/test/Makefile @@ -0,0 +1,6 @@ +Obj = main.o +Out = test.elf + +include $(SrcPath)/user/app_common.make + +LDFLAGS += -Map test.map diff --git a/src/user/test/main.c b/src/user/test/main.c new file mode 100644 index 0000000..14f6363 --- /dev/null +++ b/src/user/test/main.c @@ -0,0 +1,40 @@ +#include +#include +#include + +void thread_cascade(void* d) { + int n = (int)d; + + if (d == 0) { + //printk("{#} 0 cascade element started => end\n"); + printk("{#}0end\t"); + } else { + if (n < 0) { + //printk("{#} - cascade element started\n"); + printk("{#}-\t"); + n = 0 - n; + } else { + //printk("{#} + cascade element started\n"); + printk("{#}+\t"); + } + //printk("{#} FORK + ...\n"); + printk("{#}F+\t"); + thread_new(thread_cascade, (void*)(n - 1)); + //printk("{#} FORK - ...\n"); + printk("{#}F-\t"); + thread_new(thread_cascade, (void*)(1 - 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:4\n"); + thread_new(thread_cascade, (void*)4); + + printk("{1} Thread now sleeping...\n"); + while (1) thread_sleep(1000); + return 0; +} -- cgit v1.2.3