First working Codezero & POSIX Services with container/capability changes

This commit is contained in:
Bahadir Balban
2009-08-11 11:23:26 +03:00
parent 4f4532210a
commit f4d9520fef
3 changed files with 20 additions and 15 deletions

View File

@@ -226,13 +226,17 @@ int arch_setup_new_thread(struct ktcb *new, struct ktcb *orig,
int thread_setup_new_ids(struct task_ids *ids, unsigned int flags,
struct ktcb *new, struct ktcb *orig)
{
ids->tid = new->tid;
/*
* If thread space is new or copied,
* thread gets same group id as its thread id
*/
if (flags == THREAD_NEW_SPACE ||
flags == THREAD_COPY_SPACE)
flags == THREAD_COPY_SPACE) {
ids->tgid = ids->tid;
new->tgid = new->tid;
}
/*
* If the tgid of original thread is supplied, that implies the
@@ -240,11 +244,13 @@ int thread_setup_new_ids(struct task_ids *ids, unsigned int flags,
* it is. Otherwise the thread gets the same group id as its
* unique thread id.
*/
if (flags == THREAD_SAME_SPACE && ids->tgid != orig->tgid)
if (flags == THREAD_SAME_SPACE && ids->tgid != orig->tgid) {
ids->tgid = ids->tid;
new->tgid = new->tid;
}
/* Set all ids */
set_task_ids(new, ids);
//set_task_ids(new, ids);
return 0;
}
@@ -296,11 +302,10 @@ out:
int thread_create(struct task_ids *ids, unsigned int flags)
{
struct ktcb *new;
struct ktcb *parent;
struct ktcb *parent = 0;
int err;
flags &= THREAD_CREATE_MASK;
parent = 0;
if (!(new = tcb_alloc_init()))
return -ENOMEM;
@@ -337,7 +342,7 @@ int thread_create(struct task_ids *ids, unsigned int flags)
return 0;
out_err:
/* Pre-mature tcb needs freeing by free_page */
/* Pre-mature tcb needs freeing by free_ktcb */
free_ktcb(new);
return err;
}

View File

@@ -10,6 +10,7 @@
#include <l4/generic/preempt.h>
#include <l4/generic/space.h>
#include <l4/lib/idpool.h>
#include <l4/api/ipc.h>
#include <l4/api/kip.h>
#include <l4/api/errno.h>
#include INC_ARCH(exception.h)
@@ -25,8 +26,6 @@ void init_ktcb_list(struct ktcb_list *ktcb_list)
void tcb_init(struct ktcb *new)
{
new->tid = id_new(&kernel_container.ktcb_ids);
new->tgid = new->tid;
link_init(&new->task_list);
mutex_init(&new->thread_control_lock);
@@ -51,11 +50,19 @@ struct ktcb *tcb_alloc(void)
struct ktcb *tcb_alloc_init(void)
{
struct ktcb *tcb;
struct task_ids ids;
if (!(tcb = tcb_alloc()))
return 0;
ids.tid = id_new(&kernel_container.ktcb_ids);
ids.tgid = L4_NILTHREAD;
ids.spid = L4_NILTHREAD;
set_task_ids(tcb, &ids);
tcb_init(tcb);
return tcb;
}