diff --git a/conts/libc/include/atoi.h b/conts/libc/include/atoi.h new file mode 100644 index 0000000..f931d48 --- /dev/null +++ b/conts/libc/include/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 atoi(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/libl4/include/l4lib/ipcdefs.h b/conts/libl4/include/l4lib/ipcdefs.h index ef0f650..31537d1 100644 --- a/conts/libl4/include/l4lib/ipcdefs.h +++ b/conts/libl4/include/l4lib/ipcdefs.h @@ -62,4 +62,7 @@ #define L4_IPC_TAG_NOTIFY_FORK 46 /* Pager notifies vfs of process fork */ #define L4_IPC_TAG_NOTIFY_EXIT 47 /* Pager notifies vfs of process exit */ #define L4_IPC_TAG_PAGER_OPEN_BYPATH 48 /* Pager opens a vfs file by pathname */ + +extern l4id_t pagerid; + #endif /* __IPCDEFS_H__ */ diff --git a/conts/libl4/src/init.c b/conts/libl4/src/init.c index 0492f4c..508c682 100644 --- a/conts/libl4/src/init.c +++ b/conts/libl4/src/init.c @@ -27,6 +27,8 @@ __l4_mutex_control_t __l4_mutex_control = 0; struct kip *kip; +l4id_t pagerid; + /* * Reference to private UTCB of this thread. * Used only for pushing/reading ipc message registers. diff --git a/conts/posix/libposix/chdir.c b/conts/posix/libposix/chdir.c index 2f9988c..ce48e39 100644 --- a/conts/posix/libposix/chdir.c +++ b/conts/posix/libposix/chdir.c @@ -25,7 +25,7 @@ static inline int l4_chdir(const char *pathname) utcb_full_strcpy_from(pathname); /* Call pager with shmget() request. Check ipc error. */ - if ((fd = l4_sendrecv_full(PAGER_TID, PAGER_TID, L4_IPC_TAG_CHDIR)) < 0) { + if ((fd = l4_sendrecv_full(pagerid, pagerid, L4_IPC_TAG_CHDIR)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, fd); return fd; } diff --git a/conts/posix/libposix/close.c b/conts/posix/libposix/close.c index 2e4fc46..d45e63d 100644 --- a/conts/posix/libposix/close.c +++ b/conts/posix/libposix/close.c @@ -19,7 +19,7 @@ static inline int l4_close(int fd) write_mr(L4SYS_ARG0, fd); /* Call pager with close() request. Check ipc error. */ - if ((fd = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_CLOSE)) < 0) { + if ((fd = l4_sendrecv(pagerid, pagerid, L4_IPC_TAG_CLOSE)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, fd); return fd; } @@ -50,7 +50,7 @@ static inline int l4_fsync(int fd) write_mr(L4SYS_ARG0, fd); /* Call pager with close() request. Check ipc error. */ - if ((fd = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_FSYNC)) < 0) { + if ((fd = l4_sendrecv(pagerid, pagerid, L4_IPC_TAG_FSYNC)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, fd); return fd; } diff --git a/conts/posix/libposix/env.c b/conts/posix/libposix/env.c index 69aabee..234359d 100644 --- a/conts/posix/libposix/env.c +++ b/conts/posix/libposix/env.c @@ -9,6 +9,7 @@ char **__environ; + /* * Search for given name in name=value string pairs located * in the environment segment, and return the pointer to value diff --git a/conts/posix/libposix/execve.c b/conts/posix/libposix/execve.c index a698c7d..fc01fd1 100644 --- a/conts/posix/libposix/execve.c +++ b/conts/posix/libposix/execve.c @@ -36,7 +36,7 @@ static inline int l4_execve(const char *pathname, char *const argv[], char *cons /* Call pager with open() request. Check ipc error. */ - if ((err = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_EXECVE)) < 0) { + if ((err = l4_sendrecv(pagerid, pagerid, L4_IPC_TAG_EXECVE)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, err); return err; } diff --git a/conts/posix/libposix/exit.c b/conts/posix/libposix/exit.c index 5708360..904aabe 100644 --- a/conts/posix/libposix/exit.c +++ b/conts/posix/libposix/exit.c @@ -13,7 +13,7 @@ static inline void __attribute__ ((noreturn)) l4_exit(int status) write_mr(L4SYS_ARG0, status); /* Call pager with exit() request and block on its receive phase */ - ret = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_EXIT); + ret = l4_sendrecv(pagerid, pagerid, L4_IPC_TAG_EXIT); /* This call should not fail or return */ print_err("%s: L4 IPC returned: %d.\n", __FUNCTION__, ret); diff --git a/conts/posix/libposix/fork.c b/conts/posix/libposix/fork.c index ef1726a..f679b43 100644 --- a/conts/posix/libposix/fork.c +++ b/conts/posix/libposix/fork.c @@ -20,7 +20,7 @@ static inline int l4_fork(void) int err; /* Call pager with open() request. Check ipc error. */ - if ((err = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_FORK)) < 0) { + if ((err = l4_sendrecv(pagerid, pagerid, L4_IPC_TAG_FORK)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, err); return err; } @@ -67,7 +67,7 @@ int clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ...) write_mr(L4SYS_ARG1, flags); /* Perform an ipc but with different return logic. See implementation. */ - if ((ret = arch_clone(PAGER_TID, PAGER_TID, 0)) < 0) { + if ((ret = arch_clone(pagerid, pagerid, 0)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, ret); return ret; } diff --git a/conts/posix/libposix/lseek.c b/conts/posix/libposix/lseek.c index f72794d..44fa8aa 100644 --- a/conts/posix/libposix/lseek.c +++ b/conts/posix/libposix/lseek.c @@ -21,7 +21,7 @@ static inline off_t l4_lseek(int fildes, off_t offset, int whence) write_mr(L4SYS_ARG2, whence); /* Call pager with shmget() request. Check ipc error. */ - if ((offres = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_LSEEK)) < 0) { + if ((offres = l4_sendrecv(pagerid, pagerid, L4_IPC_TAG_LSEEK)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, offres); return offres; } diff --git a/conts/posix/libposix/mkdir.c b/conts/posix/libposix/mkdir.c index 5d5f762..ffb4996 100644 --- a/conts/posix/libposix/mkdir.c +++ b/conts/posix/libposix/mkdir.c @@ -29,7 +29,7 @@ static inline int l4_mkdir(const char *pathname, mode_t mode) write_mr(L4SYS_ARG0, (u32)mode); /* Call pager with shmget() request. Check ipc error. */ - if ((fd = l4_sendrecv_full(PAGER_TID, PAGER_TID, L4_IPC_TAG_MKDIR)) < 0) { + if ((fd = l4_sendrecv_full(pagerid, pagerid, L4_IPC_TAG_MKDIR)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, fd); return fd; } diff --git a/conts/posix/libposix/mmap.c b/conts/posix/libposix/mmap.c index 9c4bac1..7efefcc 100644 --- a/conts/posix/libposix/mmap.c +++ b/conts/posix/libposix/mmap.c @@ -43,7 +43,7 @@ static inline void *l4_mmap(void *start, size_t length, int prot, int flags, int write_mr(L4SYS_ARG0, (unsigned long)&desc); /* Call pager with MMAP request. Check ipc error. */ - if ((ret = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_MMAP)) < 0) { + if ((ret = l4_sendrecv(pagerid, pagerid, L4_IPC_TAG_MMAP)) < 0) { print_err("%s: IPC Error: %d.\n", __FUNCTION__, ret); return PTR_ERR(ret); } @@ -79,7 +79,7 @@ int l4_munmap(void *start, size_t length) write_mr(L4SYS_ARG1, length); /* Call pager with MMAP request. */ - if ((err = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_MUNMAP)) < 0) { + if ((err = l4_sendrecv(pagerid, pagerid, L4_IPC_TAG_MUNMAP)) < 0) { print_err("%s: IPC Error: %d.\n", __FUNCTION__, err); return err; } @@ -111,7 +111,7 @@ int l4_msync(void *start, size_t length, int flags) write_mr(L4SYS_ARG2, flags); /* Call pager with MMAP request. */ - if ((errno = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_MSYNC)) < 0) { + if ((errno = l4_sendrecv(pagerid, pagerid, L4_IPC_TAG_MSYNC)) < 0) { print_err("%s: IPC Error: %d.\n", __FUNCTION__, errno); return -1; } diff --git a/conts/posix/libposix/open.c b/conts/posix/libposix/open.c index 0231f26..2c1155a 100644 --- a/conts/posix/libposix/open.c +++ b/conts/posix/libposix/open.c @@ -30,7 +30,7 @@ static inline int l4_open(const char *pathname, int flags, mode_t mode) write_mr(L4SYS_ARG1, (u32)mode); /* Call pager with open() request. Check ipc error. */ - if ((fd = l4_sendrecv_full(PAGER_TID, PAGER_TID, L4_IPC_TAG_OPEN)) < 0) { + if ((fd = l4_sendrecv_full(pagerid, pagerid, L4_IPC_TAG_OPEN)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, fd); return fd; } diff --git a/conts/posix/libposix/read.c b/conts/posix/libposix/read.c index 0546dc7..c451f17 100644 --- a/conts/posix/libposix/read.c +++ b/conts/posix/libposix/read.c @@ -36,13 +36,13 @@ static inline int l4_readdir(int fd, void *buf, size_t count) write_mr(L4SYS_ARG1, count); /* Call pager with readdir() request. Check ipc error. */ - if ((err = l4_send(PAGER_TID, L4_IPC_TAG_READDIR)) < 0) { + if ((err = l4_send(pagerid, L4_IPC_TAG_READDIR)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, err); return err; } /* Call pager with readdir() request. Check ipc error. */ - if ((err = l4_receive_extended(PAGER_TID, + if ((err = l4_receive_extended(pagerid, L4_IPC_EXTENDED_MAX_SIZE, buf)) < 0) { print_err("%s: L4 Extended IPC error: %d.\n", __FUNCTION__, err); @@ -68,7 +68,7 @@ static inline int l4_readdir(int fd, void *buf, size_t count) write_mr(L4SYS_ARG2, count); /* Call pager with readdir() request. Check ipc error. */ - if ((cnt = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_READDIR)) < 0) { + if ((cnt = l4_sendrecv(pagerid, pagerid, L4_IPC_TAG_READDIR)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, cnt); return cnt; } @@ -91,7 +91,7 @@ static inline int l4_read(int fd, void *buf, size_t count) write_mr(L4SYS_ARG2, count); /* Call pager with read() request. Check ipc error. */ - if ((cnt = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_READ)) < 0) { + if ((cnt = l4_sendrecv(pagerid, pagerid, L4_IPC_TAG_READ)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, cnt); return cnt; } diff --git a/conts/posix/libposix/shm.c b/conts/posix/libposix/shm.c index 6094e74..65204a9 100644 --- a/conts/posix/libposix/shm.c +++ b/conts/posix/libposix/shm.c @@ -23,7 +23,7 @@ int l4_shmget(l4id_t key, int size, int shmflg) write_mr(L4SYS_ARG2, shmflg); /* Call pager with shmget() request. Check ipc error. */ - if ((err = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_SHMGET)) < 0) { + if ((err = l4_sendrecv(pagerid, pagerid, L4_IPC_TAG_SHMGET)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, err); return err; } @@ -46,7 +46,7 @@ void *l4_shmat(l4id_t shmid, const void *shmaddr, int shmflg) write_mr(L4SYS_ARG2, shmflg); /* Call pager with shmget() request. Check ipc error. */ - if ((err = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_SHMAT)) < 0) { + if ((err = l4_sendrecv(pagerid, pagerid, L4_IPC_TAG_SHMAT)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, err); return PTR_ERR(err); } @@ -67,7 +67,7 @@ int l4_shmdt(const void *shmaddr) write_mr(L4SYS_ARG0, (unsigned long)shmaddr); /* Call pager with shmget() request. Check ipc error. */ - if ((err = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_SHMDT)) < 0) { + if ((err = l4_sendrecv(pagerid, pagerid, L4_IPC_TAG_SHMDT)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, err); return -1; } diff --git a/conts/posix/libposix/shpage.c b/conts/posix/libposix/shpage.c index cb3997a..34446ab 100644 --- a/conts/posix/libposix/shpage.c +++ b/conts/posix/libposix/shpage.c @@ -46,7 +46,7 @@ static void *shared_page_address(void) write_mr(L4SYS_ARG0, self_tid()); /* Call pager with utcb address request. Check ipc error. */ - if ((err = l4_sendrecv(PAGER_TID, PAGER_TID, + if ((err = l4_sendrecv(pagerid, pagerid, L4_IPC_TAG_SHPAGE)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, err); return PTR_ERR(err); @@ -76,7 +76,7 @@ int shared_page_init(void) * Initialise shared page only if we're not the pager. * The pager does it differently for itself. */ - BUG_ON(self_tid() == PAGER_TID); + BUG_ON(self_tid() == pagerid); /* Obtain our shared page address */ shared_page = shared_page_address(); diff --git a/conts/posix/libposix/stat.c b/conts/posix/libposix/stat.c index ed27bee..e87b869 100644 --- a/conts/posix/libposix/stat.c +++ b/conts/posix/libposix/stat.c @@ -30,7 +30,7 @@ static inline int l4_fstat(int fd, void *buffer) write_mr(L4SYS_ARG1, (unsigned long)buffer); /* Call pager with open() request. Check ipc error. */ - if ((err = l4_sendrecv_full(PAGER_TID, PAGER_TID, L4_IPC_TAG_FSTAT)) < 0) { + if ((err = l4_sendrecv_full(pagerid, pagerid, L4_IPC_TAG_FSTAT)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, err); return err; } @@ -75,7 +75,7 @@ static inline int l4_stat(const char *pathname, void *buffer) write_mr(L4SYS_ARG1, (unsigned long)&ks); /* Call vfs with stat() request. Check ipc error. */ - if ((err = l4_sendrecv_full(PAGER_TID, PAGER_TID, L4_IPC_TAG_STAT)) < 0) { + if ((err = l4_sendrecv_full(pagerid, pagerid, L4_IPC_TAG_STAT)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, err); return err; } diff --git a/conts/posix/libposix/write.c b/conts/posix/libposix/write.c index 60d1cb6..c5cd32b 100644 --- a/conts/posix/libposix/write.c +++ b/conts/posix/libposix/write.c @@ -21,7 +21,7 @@ static inline int l4_write(int fd, const void *buf, size_t count) write_mr(L4SYS_ARG2, count); /* Call pager with write() request. Check ipc error. */ - if ((wrcnt = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_WRITE)) < 0) { + if ((wrcnt = l4_sendrecv(pagerid, pagerid, L4_IPC_TAG_WRITE)) < 0) { print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, wrcnt); return wrcnt; } diff --git a/conts/posix/mm0/mm/execve.c b/conts/posix/mm0/mm/execve.c index 27c764b..5da170d 100644 --- a/conts/posix/mm0/mm/execve.c +++ b/conts/posix/mm0/mm/execve.c @@ -42,7 +42,7 @@ int init_execve(char *filepath) struct exec_file_desc efd; struct tcb *new_task, *self; struct args_struct args, env; - char *env_string = "pagerid=0"; + char env_string[30]; int err; int fd; @@ -52,6 +52,8 @@ int init_execve(char *filepath) .tgid = TASK_ID_INVALID, }; + sprintf(env_string, "pagerid=%d", self_tid()); + /* Set up args_struct */ args.argc = 1; args.argv = alloca(sizeof(args.argv)); diff --git a/conts/posix/mm0/mm/task.c b/conts/posix/mm0/mm/task.c index 41c07c0..4255e84 100644 --- a/conts/posix/mm0/mm/task.c +++ b/conts/posix/mm0/mm/task.c @@ -434,8 +434,6 @@ struct tcb *task_create(struct tcb *parent, struct task_ids *ids, * * (low) |->argc|argv[0]|argv[1]|...|argv[argc] = 0|envp[0]|envp[1]|...|NULL| (high) * - * IOW: - * * argc * argv pointers * null @@ -447,8 +445,10 @@ struct tcb *task_create(struct tcb *parent, struct task_ids *ids, * space, heap seems to get used in uClibc. * */ -int task_copy_args_to_user(char *user_stack, unsigned long user_ptr, - struct args_struct *args, struct args_struct *env) +int task_copy_args_to_user(char *user_stack, + unsigned long user_ptr, + struct args_struct *args, + struct args_struct *env) { char **argv_start, **envp_start; @@ -503,6 +503,7 @@ int task_copy_args_to_user(char *user_stack, unsigned long user_ptr, | ((unsigned long)user_stack & PAGE_MASK)); + /* Update location */ user_stack += strlen(env->argv[i]) + 1; } diff --git a/conts/posix/test0/container.c b/conts/posix/test0/container.c index 68a9b8a..e7be904 100644 --- a/conts/posix/test0/container.c +++ b/conts/posix/test0/container.c @@ -15,15 +15,12 @@ int main(int argc, char *argv[]); int __container_init(int argc, char **argv) { void *envp = &argv[argc + 1]; - char *pagerval; if ((char *)envp == *argv) envp = &argv[argc]; __libposix_init(envp); - pagerval = getenv("pagerid"); - /* Generic L4 thread initialisation */ __l4_init(); diff --git a/conts/posix/test0/include/atoi.h b/conts/posix/test0/include/atoi.h new file mode 100644 index 0000000..7684261 --- /dev/null +++ b/conts/posix/test0/include/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/main.c b/conts/posix/test0/main.c index fe6d104..b34ed8c 100644 --- a/conts/posix/test0/main.c +++ b/conts/posix/test0/main.c @@ -13,6 +13,8 @@ #include #include #include +#include +#include void wait_pager(l4id_t partner) { @@ -24,6 +26,7 @@ void wait_pager(l4id_t partner) } pid_t parent_of_all; +pid_t pagerid; int main(int argc, char *argv[]) { @@ -32,6 +35,8 @@ int main(int argc, char *argv[]) parent_of_all = getpid(); + pagerid = ascii_to_int(getenv("pagerid")); + wait_pager(0); printf("\n%s: Running POSIX API tests.\n", __TASKNAME__); diff --git a/conts/posix/test0/src/exectest.c b/conts/posix/test0/src/exectest.c index 36582b7..38ede37 100644 --- a/conts/posix/test0/src/exectest.c +++ b/conts/posix/test0/src/exectest.c @@ -10,6 +10,7 @@ #include #include #include +#include #define PAGE_SIZE 0x1000 @@ -22,10 +23,11 @@ int exectest(pid_t parent_of_all) void *exec_start = (void *)_start_test_exec; unsigned long size = _end_test_exec - _start_test_exec; char filename[128]; - char env_string[30]; + char env_string1[30]; + char env_string2[30]; int left, cnt; char *argv[5]; - char *envp[2]; + char *envp[3]; memset(filename, 0, 128); sprintf(filename, "/home/bahadir/execfile%d", getpid()); @@ -90,10 +92,14 @@ int exectest(pid_t parent_of_all) argv[3] = "FOURTH ARG"; argv[4] = 0; - memset(env_string, 0, 30); - sprintf(env_string, "parent_of_all=%d", parent_of_all); - envp[0] = env_string; - envp[1] = 0; /* This is important as the array needs to end with a null */ + memset(env_string1, 0, 30); + memset(env_string2, 0, 30); + sprintf(env_string1, "parent_of_all=%d", parent_of_all); + sprintf(env_string2, "pagerid=%d", pagerid); + + envp[0] = env_string1; + envp[1] = env_string2; + envp[2] = 0; /* This is important as the array needs to end with a null */ /* Execute the file */ err = execve(filename, argv, envp); diff --git a/conts/posix/test0/src/ipctest.c b/conts/posix/test0/src/ipctest.c index 150b016..7c0e988 100644 --- a/conts/posix/test0/src/ipctest.c +++ b/conts/posix/test0/src/ipctest.c @@ -25,7 +25,7 @@ void ipc_full_test(void) } /* Call the pager */ - if ((ret = l4_sendrecv_full(PAGER_TID, PAGER_TID, + if ((ret = l4_sendrecv_full(pagerid, pagerid, L4_IPC_TAG_SYNC_FULL)) < 0) { printf("%s: Failed with %d\n", __FUNCTION__, ret); BUG(); diff --git a/conts/test/SConstruct b/conts/test/SConstruct deleted file mode 100644 index 23e059c..0000000 --- a/conts/test/SConstruct +++ /dev/null @@ -1,55 +0,0 @@ -# -*- mode: python; coding: utf-8; -*- -# -# Codezero -- Virtualization microkernel for embedded systems. -# -# Copyright © 2009 B Labs Ltd -# -import os, shelve, sys -from os.path import * - -PROJRELROOT = '../..' - -sys.path.append(PROJRELROOT) - -from config.projpaths import * -from config.configuration import * - - -config = configuration_retrieve() - -arch = config.arch - -LIBL4_RELDIR = 'conts/libl4' -KERNEL_INCLUDE = join(PROJROOT, 'include') -LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR) -LIBL4_INCLUDE = join(LIBL4_DIR, 'include') -LIBL4_LIBPATH = join(BUILDDIR, LIBL4_RELDIR) - -# Locally important paths are here -LIBC_RELDIR = 'conts/libc' -LIBC_DIR = join(PROJROOT, LIBC_RELDIR) -LIBC_LIBPATH = join(BUILDDIR, LIBC_RELDIR) -LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \ - join(LIBC_DIR, 'include/arch' + '/' + arch)] - - -env = Environment(CC = 'arm-none-linux-gnueabi-gcc', - # We don't use -nostdinc because sometimes we need standard headers, - # such as stdarg.h e.g. for variable args, as in printk(). - CCFLAGS = ['-g', '-mcpu=arm926ej-s', '-nostdlib', '-ffreestanding', \ - '-std=gnu99', '-Wall', '-Werror'], \ - LINKFLAGS = ['-nostdlib', '-T' + "include/linker.lds", "-u_start"],\ - ASFLAGS = ['-D__ASSEMBLY__'], \ - PROGSUFFIX = '.elf', # The suffix to use for final executable\ - ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path\ - LIBS = ['gcc', 'libl4', 'c-userspace', 'gcc', 'c-userspace'], # libgcc.a - This is required for division routines. - CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBC_INCLUDE], - LIBPATH = [LIBL4_LIBPATH, LIBC_LIBPATH], - CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h') - -src = Glob('*.[cS]') -src += Glob('src/*.[cS]') - -objs = env.Object(src) -prog = env.Program('main.elf', objs) -Depends(prog, 'include/linker.lds') diff --git a/conts/test/container.c b/conts/test/container.c deleted file mode 100644 index 7bcbf9e..0000000 --- a/conts/test/container.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Container entry point for pager - * - * Copyright (C) 2007-2009 B Labs Ltd. - */ - -#include -#include - - -void main(void); - -void __container_init(void) -{ - /* Generic L4 initialisation */ - __l4_init(); - - /* Entry to main */ - main(); -} - diff --git a/conts/test/hello.c b/conts/test/hello.c deleted file mode 100644 index 054adc9..0000000 --- a/conts/test/hello.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Autogenerated hello world print function - */ - -#include -#include - -int print_hello_world(void) -{ - printf("%s: Hello world from %s!\n", __CONTAINER__, __CONTAINER_NAME__); - return 0; -} - diff --git a/conts/test/include/linker.lds b/conts/test/include/linker.lds deleted file mode 100644 index abb38b5..0000000 --- a/conts/test/include/linker.lds +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Example working linker script for this container. - * - * Copyright (C) 2009 B Labs Ltd. - */ - -vma_start = 0x0; -lma_start = 0x1000000; -offset = vma_start - lma_start; - -ENTRY(_start) - -SECTIONS -{ - . = vma_start; - .text : AT (ADDR(.text) - offset) { - /* - * NOTE: - * crt0.S must be in .text.head. This is necessary because - * the kernel does not know any _start address, it assumes - * the start address of pager region as the start address. - */ - *(.text.head) *(.text) - } - .rodata : AT (ADDR(.rodata) - offset) { *(.rodata) } - .rodata1 : AT (ADDR(.rodata1) - offset) { *(.rodata1) } - - . = ALIGN(4K); - .data : AT (ADDR(.data) - offset) { *(.data) } - .bss : AT (ADDR(.bss) - offset) { *(.bss) } - . += 0x1000; - . = ALIGN(8); - __stack = .; -} diff --git a/conts/test/include/test.h b/conts/test/include/test.h deleted file mode 100644 index e69de29..0000000 diff --git a/conts/test/main.c b/conts/test/main.c deleted file mode 100644 index d2d8ed6..0000000 --- a/conts/test/main.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Main function for this container - */ -#include -#include -#include - -extern int print_hello_world(void); - -int main(void) -{ - print_hello_world(); - - return 0; -} - diff --git a/conts/test/src/test.c b/conts/test/src/test.c deleted file mode 100644 index e69de29..0000000 diff --git a/include/l4/api/kip.h b/include/l4/api/kip.h index 52e3b85..9ff8708 100644 --- a/include/l4/api/kip.h +++ b/include/l4/api/kip.h @@ -71,14 +71,6 @@ struct kip { struct kernel_descriptor kdesc; } __attribute__((__packed__)); -/* - * Task id defs for priviledged server tasks. These are dynamically allocated - * from the id pool, but still the pool should allocate them in this order. - */ -#define PAGER_TID 0 -#define VFS_TID 1 -#define BLKDEV_TID 2 - #define __PAGERNAME__ "mm0" #define __VFSNAME__ "fs0" #define __BLKDEVNAME__ "blkdev0"