From a3a90530dfb0f6b3cd0e511bcda281b7eb65f9a5 Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Sun, 18 Oct 2009 16:16:32 +0300 Subject: [PATCH] Fixed a few minor issues. --- conts/posix/test0/main.c | 4 ++-- conts/posix/test0/src/test_exec/atoi.h | 26 +++++++++++++++++++++ conts/posix/test0/src/test_exec/test_exec.c | 6 ++++- loader/SConscript | 5 ---- loader/libs/elf/src/elf.c | 2 +- loader/linker.lds | 2 +- scripts/conts/containers.py | 2 +- src/arch/arm/exception.c | 2 +- src/generic/scheduler.c | 3 ++- src/lib/memcache.c | 2 +- 10 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 conts/posix/test0/src/test_exec/atoi.h diff --git a/conts/posix/test0/main.c b/conts/posix/test0/main.c index b34ed8c..eeba774 100644 --- a/conts/posix/test0/main.c +++ b/conts/posix/test0/main.c @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) pagerid = ascii_to_int(getenv("pagerid")); - wait_pager(0); + wait_pager(pagerid); printf("\n%s: Running POSIX API tests.\n", __TASKNAME__); @@ -66,6 +66,6 @@ int main(int argc, char *argv[]) exectest(parent_of_all); while (1) - wait_pager(0); + wait_pager(pagerid); } diff --git a/conts/posix/test0/src/test_exec/atoi.h b/conts/posix/test0/src/test_exec/atoi.h new file mode 100644 index 0000000..7684261 --- /dev/null +++ b/conts/posix/test0/src/test_exec/atoi.h @@ -0,0 +1,26 @@ +#ifndef __ATOI_H__ +#define __ATOI_H__ + +static inline int power(int exp, int mul) +{ + int total = 1; + + while (exp > 0) { + total *= mul; + exp--; + } + return total; +} + +static inline int ascii_to_int(char *str) +{ + int size = strlen(str); + int iter = size - 1; + int num = 0; + + for (int i = 0; i < size; i++) + num += ((int)str[iter - i] - 48) * power(i, 10); + return num; +} + +#endif diff --git a/conts/posix/test0/src/test_exec/test_exec.c b/conts/posix/test0/src/test_exec/test_exec.c index 9faccc6..3eb42b2 100644 --- a/conts/posix/test0/src/test_exec/test_exec.c +++ b/conts/posix/test0/src/test_exec/test_exec.c @@ -13,6 +13,7 @@ #include #include #include +#include "atoi.h" void wait_pager(l4id_t partner) { @@ -23,6 +24,8 @@ void wait_pager(l4id_t partner) // printf("Pager synced with us.\n"); } +pid_t pagerid; + int main(int argc, char *argv[]) { wait_pager(0); @@ -43,13 +46,14 @@ int main(int argc, char *argv[]) /* Get parent of all pid as a string from environment */ parent_of_all = getenv("parent_of_all"); + pagerid = ascii_to_int(getenv("pagerid")); /* Compare two pid strings. We use strings because we dont have atoi() */ if (!strcmp(pidbuf, parent_of_all)) { printf("EXECVE TEST -- PASSED --\n"); printf("\nThread (%d): Continues to sync with the pager...\n\n", getpid()); while (1) - wait_pager(0); + wait_pager(pagerid); } out: _exit(0); diff --git a/loader/SConscript b/loader/SConscript index 738e8f5..57f7d9d 100644 --- a/loader/SConscript +++ b/loader/SConscript @@ -17,11 +17,6 @@ PROJRELROOT = '../../' from config.projpaths import * from scripts.loader.generate_loader_asm import * -#loader_ksyms = generate_ksym_to_loader(join(PROJROOT, 'loader/ksyms.S'), \ -# join(BUILDDIR, 'kernel.elf')) - -#loader_ksyms = Command([]'ksyms.S', 'kernel.elf', ksym_to_loader) - def ksym_to_loader(target, source, env): generate_ksym_to_loader(target[0].path, source[0].path) diff --git a/loader/libs/elf/src/elf.c b/loader/libs/elf/src/elf.c index d4a7839..d9c810a 100644 --- a/loader/libs/elf/src/elf.c +++ b/loader/libs/elf/src/elf.c @@ -385,7 +385,7 @@ elf_loadFile(void *elfFile, bool phys) // printf("Memory cleared.\n"); } // And this one - //printf("\n"); +// printf("\n"); return true; } diff --git a/loader/linker.lds b/loader/linker.lds index e2eca87..d356d27 100644 --- a/loader/linker.lds +++ b/loader/linker.lds @@ -7,7 +7,7 @@ ENTRY(_start) SECTIONS { - . = 0x2000000; + . = 0x3000000; .text : { *(.text.head) *(.text) } .rodata : { *(.rodata) } .rodata1 : { *(.rodata1) } diff --git a/scripts/conts/containers.py b/scripts/conts/containers.py index 08e012f..a6036e0 100755 --- a/scripts/conts/containers.py +++ b/scripts/conts/containers.py @@ -50,7 +50,7 @@ def build_posix_container(projpaths, container): images = [] cwd = os.getcwd() os.chdir(POSIXDIR) - print '\nBuilding the Posix Container...' + print '\nBuilding Posix Container %d...' % container.id scons_cmd = 'scons ' + 'cont=' + str(container.id) #print "Issuing scons command: %s" % scons_cmd os.system(scons_cmd) diff --git a/src/arch/arm/exception.c b/src/arch/arm/exception.c index c8b15b9..19034f6 100644 --- a/src/arch/arm/exception.c +++ b/src/arch/arm/exception.c @@ -19,7 +19,7 @@ #include INC_SUBARCH(mm.h) /* Abort debugging conditions */ -// #define DEBUG_ABORTS +#define DEBUG_ABORTS #if defined (DEBUG_ABORTS) #define dbg_abort(...) dprintk(__VA_ARGS__) #else diff --git a/src/generic/scheduler.c b/src/generic/scheduler.c index 6d296f5..37af6ef 100644 --- a/src/generic/scheduler.c +++ b/src/generic/scheduler.c @@ -268,7 +268,8 @@ static inline void context_switch(struct ktcb *next) { struct ktcb *cur = current; - // printk("(%d) to (%d)\n", cur->tid, next->tid); + //printk("(%d) to (%d)\n", cur->tid, next->tid); + /* Flush caches and everything */ arch_hardware_flush(TASK_PGD(next)); diff --git a/src/lib/memcache.c b/src/lib/memcache.c index b9695c0..f1800eb 100644 --- a/src/lib/memcache.c +++ b/src/lib/memcache.c @@ -23,7 +23,7 @@ void *mem_cache_alloc(struct mem_cache *cache) { int bit; int err; - + printk("%s Called\n", __FUNCTION__); if (cache->free > 0) { if ((err = mutex_lock(&cache->mutex)) < 0) return PTR_ERR(err); /* Interruptible mutex */