Fixed a few minor issues.

This commit is contained in:
Bahadir Balban
2009-10-18 16:16:32 +03:00
parent 72af4a843a
commit a3a90530df
10 changed files with 40 additions and 14 deletions

View File

@@ -37,7 +37,7 @@ int main(int argc, char *argv[])
pagerid = ascii_to_int(getenv("pagerid")); pagerid = ascii_to_int(getenv("pagerid"));
wait_pager(0); wait_pager(pagerid);
printf("\n%s: Running POSIX API tests.\n", __TASKNAME__); printf("\n%s: Running POSIX API tests.\n", __TASKNAME__);
@@ -66,6 +66,6 @@ int main(int argc, char *argv[])
exectest(parent_of_all); exectest(parent_of_all);
while (1) while (1)
wait_pager(0); wait_pager(pagerid);
} }

View File

@@ -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

View File

@@ -13,6 +13,7 @@
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <stdlib.h> #include <stdlib.h>
#include "atoi.h"
void wait_pager(l4id_t partner) void wait_pager(l4id_t partner)
{ {
@@ -23,6 +24,8 @@ void wait_pager(l4id_t partner)
// printf("Pager synced with us.\n"); // printf("Pager synced with us.\n");
} }
pid_t pagerid;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
wait_pager(0); wait_pager(0);
@@ -43,13 +46,14 @@ int main(int argc, char *argv[])
/* Get parent of all pid as a string from environment */ /* Get parent of all pid as a string from environment */
parent_of_all = getenv("parent_of_all"); 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() */ /* Compare two pid strings. We use strings because we dont have atoi() */
if (!strcmp(pidbuf, parent_of_all)) { if (!strcmp(pidbuf, parent_of_all)) {
printf("EXECVE TEST -- PASSED --\n"); printf("EXECVE TEST -- PASSED --\n");
printf("\nThread (%d): Continues to sync with the pager...\n\n", getpid()); printf("\nThread (%d): Continues to sync with the pager...\n\n", getpid());
while (1) while (1)
wait_pager(0); wait_pager(pagerid);
} }
out: out:
_exit(0); _exit(0);

View File

@@ -17,11 +17,6 @@ PROJRELROOT = '../../'
from config.projpaths import * from config.projpaths import *
from scripts.loader.generate_loader_asm 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): def ksym_to_loader(target, source, env):
generate_ksym_to_loader(target[0].path, source[0].path) generate_ksym_to_loader(target[0].path, source[0].path)

View File

@@ -385,7 +385,7 @@ elf_loadFile(void *elfFile, bool phys)
// printf("Memory cleared.\n"); // printf("Memory cleared.\n");
} }
// And this one // And this one
//printf("\n"); // printf("\n");
return true; return true;
} }

View File

@@ -7,7 +7,7 @@ ENTRY(_start)
SECTIONS SECTIONS
{ {
. = 0x2000000; . = 0x3000000;
.text : { *(.text.head) *(.text) } .text : { *(.text.head) *(.text) }
.rodata : { *(.rodata) } .rodata : { *(.rodata) }
.rodata1 : { *(.rodata1) } .rodata1 : { *(.rodata1) }

View File

@@ -50,7 +50,7 @@ def build_posix_container(projpaths, container):
images = [] images = []
cwd = os.getcwd() cwd = os.getcwd()
os.chdir(POSIXDIR) os.chdir(POSIXDIR)
print '\nBuilding the Posix Container...' print '\nBuilding Posix Container %d...' % container.id
scons_cmd = 'scons ' + 'cont=' + str(container.id) scons_cmd = 'scons ' + 'cont=' + str(container.id)
#print "Issuing scons command: %s" % scons_cmd #print "Issuing scons command: %s" % scons_cmd
os.system(scons_cmd) os.system(scons_cmd)

View File

@@ -19,7 +19,7 @@
#include INC_SUBARCH(mm.h) #include INC_SUBARCH(mm.h)
/* Abort debugging conditions */ /* Abort debugging conditions */
// #define DEBUG_ABORTS #define DEBUG_ABORTS
#if defined (DEBUG_ABORTS) #if defined (DEBUG_ABORTS)
#define dbg_abort(...) dprintk(__VA_ARGS__) #define dbg_abort(...) dprintk(__VA_ARGS__)
#else #else

View File

@@ -268,7 +268,8 @@ static inline void context_switch(struct ktcb *next)
{ {
struct ktcb *cur = current; 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 */ /* Flush caches and everything */
arch_hardware_flush(TASK_PGD(next)); arch_hardware_flush(TASK_PGD(next));

View File

@@ -23,7 +23,7 @@ void *mem_cache_alloc(struct mem_cache *cache)
{ {
int bit; int bit;
int err; int err;
printk("%s Called\n", __FUNCTION__);
if (cache->free > 0) { if (cache->free > 0) {
if ((err = mutex_lock(&cache->mutex)) < 0) if ((err = mutex_lock(&cache->mutex)) < 0)
return PTR_ERR(err); /* Interruptible mutex */ return PTR_ERR(err); /* Interruptible mutex */