From 0b3ab05a9870763e287a26434f466aa065a27e60 Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Fri, 12 Sep 2008 10:47:36 +0300 Subject: [PATCH] Some minor changes Need to reimplement exchange_registers --- src/api/thread.c | 8 +++++--- tasks/libl4/include/l4lib/arch-arm/syslib.h | 7 ++++--- tasks/libposix/fork.c | 2 +- tasks/mm0/src/clone.c | 3 ++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/api/thread.c b/src/api/thread.c index acd9eb7..e65f7b2 100644 --- a/src/api/thread.c +++ b/src/api/thread.c @@ -104,7 +104,7 @@ int arch_setup_new_thread(struct ktcb *new, struct ktcb *orig) * policy on the microkernel, but it is currently the best solution. * * A cleaner but slower way would be the pager setting child registers - * via exchanges_registers() and start the child thread afterwards. + * via exchange_registers() and start the child thread afterwards. */ KTCB_REF_MR0(new)[MR_RETURN] = 0; @@ -129,7 +129,7 @@ int arch_setup_new_thread(struct ktcb *new, struct ktcb *orig) } int thread_setup_new_ids(struct task_ids *ids, unsigned int flags, - struct tcb *new, struct tcb *orig) + struct ktcb *new, struct ktcb *orig) { /* For tid, allocate requested id if it's available, else a new one */ if ((ids->tid = id_get(thread_id_pool, ids->tid)) < 0) @@ -158,7 +158,7 @@ int thread_setup_new_ids(struct task_ids *ids, unsigned int flags, /* If thread space is the same, tgid is either new or existing one */ if (flags == THREAD_CREATE_SAMESPC) { /* Check if same tgid is expected */ - if (ids->tgid != task->tgid) { + if (ids->tgid != orig->tgid) { if ((ids->tgid = id_get(tgroup_id_pool, ids->tgid)) < 0) ids->tgid = id_new(tgroup_id_pool); @@ -167,6 +167,8 @@ int thread_setup_new_ids(struct task_ids *ids, unsigned int flags, /* Set all ids */ set_task_ids(new, ids); + + return 0; } /* diff --git a/tasks/libl4/include/l4lib/arch-arm/syslib.h b/tasks/libl4/include/l4lib/arch-arm/syslib.h index 3443814..ba6fc7c 100644 --- a/tasks/libl4/include/l4lib/arch-arm/syslib.h +++ b/tasks/libl4/include/l4lib/arch-arm/syslib.h @@ -40,9 +40,10 @@ static inline l4id_t l4_get_sender(void) /* * When doing an ipc the sender never has to be explicitly set in - * the utcb via this function since it is passed in the argument - * registers. This is only used for restoring the sender on the - * utcb in order to complete an earlier ipc. + * the utcb via this function since this information is found out + * by the microkernel by checking the system caller's id. This is + * only used for restoring the sender on the utcb in order to + * complete an earlier ipc. */ static inline void l4_set_sender(l4id_t sender) { diff --git a/tasks/libposix/fork.c b/tasks/libposix/fork.c index b05fc5d..435a9fd 100644 --- a/tasks/libposix/fork.c +++ b/tasks/libposix/fork.c @@ -47,7 +47,7 @@ int fork(void) return ret; } -extern int arch_clone(int, int); +extern int arch_clone(l4id_t to, l4id_t from); int clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ...) { diff --git a/tasks/mm0/src/clone.c b/tasks/mm0/src/clone.c index 7d7c63b..84472f5 100755 --- a/tasks/mm0/src/clone.c +++ b/tasks/mm0/src/clone.c @@ -54,6 +54,7 @@ int do_fork(struct tcb *parent) struct task_ids ids = { .tid = TASK_ID_INVALID, .spid = parent->spid, + .tgid = TASK_ID_INVALID /* FIXME: !!! FIX THIS */ }; /* Make all shadows in this task read-only */ @@ -81,7 +82,7 @@ int do_fork(struct tcb *parent) l4_ipc_return((int)utcb_shm); return 0; } - /* FIXME: We should munmap() parent's utcb page from child */ + /* FIXME: Should we munmap() parent's utcb page from child? */ /* * Map and prefault child utcb to vfs so that vfs need not