Merge branch 'libl4thread' of git://www.b-labs.co.uk/bora/git/codezero into bora

Conflicts:
	conts/libl4thread/src/arch-arm/new_thread.S
	conts/libl4thread/src/idpool.c
This commit is contained in:
Bahadir Balban
2009-11-19 11:17:51 +02:00
14 changed files with 453 additions and 178 deletions

View File

@@ -1,5 +1,5 @@
/*
* Address allocation pool
* Address allocation pool.
*
* Copyright (C) 2007 Bahadir Balban
*/
@@ -21,7 +21,7 @@ int address_pool_init_with_idpool(struct address_pool *pool,
int address_pool_init(struct address_pool *pool,
unsigned long start, unsigned long end,
int size);
void *address_new(struct address_pool *pool, int npages);
int address_del(struct address_pool *, void *addr, int npages);
void *address_new(struct address_pool *pool, int nitems, int size);
int address_del(struct address_pool *, void *addr, int nitems, int size);
#endif /* __ADDR_H__ */

View File

@@ -0,0 +1,19 @@
/*
* Stack space helper routines.
*
* Copyright (C) 2009 B Labs Ltd.
*/
#ifndef __LIB_STACK_H__
#define __LIB_STACK_H__
/* Checks if l4_set_stack_params is called. */
#define IS_STACK_SETUP() (lib_stack_size)
int stack_pool_init(unsigned long stack_start,
unsigned long stack_end,
unsigned long stack_size);
void *get_stack_space(void);
int delete_stack_space(void *stack_address);
#endif /* __LIB_STACK_H__ */

View File

@@ -14,22 +14,30 @@ struct utcb_head {
};
/* A simple thread control block for the thread library. */
struct l4t_tcb {
struct tcb {
/* Task list */
struct link list;
/* Task id */
int tid;
/* Chain of utcb descriptors */
struct utcb_head *utcb_head;
/* Stack and utcb address */
unsigned long utcb_addr;
unsigned long stack_addr;
};
/* This struct keeps track of all the threads handled by the thread lib. */
struct l4t_global_list {
/* All the threads handled by the thread lib are kept in this list. */
struct global_list {
int total;
struct link list;
};
struct l4t_tcb *l4t_find_task(int tid);
struct l4t_tcb *l4t_tcb_alloc_init(struct l4t_tcb *parent, unsigned int flags);
void l4t_global_add_task(struct l4t_tcb *task);
void l4t_global_remove_task(struct l4t_tcb *task);
struct tcb *find_task(int tid);
struct tcb *tcb_alloc_init(struct tcb *parent, unsigned int flags);
void global_add_task(struct tcb *task);
void global_remove_task(struct tcb *task);
#endif /* __LIB_TCB_H__ */

View File

@@ -6,13 +6,13 @@
#ifndef __LIB_THREAD_H__
#define __LIB_THREAD_H__
int set_stack_params(unsigned long stack_top,
int l4_set_stack_params(unsigned long stack_top,
unsigned long stack_bottom,
unsigned long stack_size);
int set_utcb_params(unsigned long utcb_start, unsigned long utcb_end);
int l4_set_utcb_params(unsigned long utcb_start, unsigned long utcb_end);
int l4thread_create(struct task_ids *ids, unsigned int flags,
int l4_thread_create(struct task_ids *ids, unsigned int flags,
int (*func)(void *), void *arg);
void l4thread_kill(struct task_ids *ids);
void l4_thread_exit(int retval);
#endif /* __LIB_THREAD_H__ */

View File

@@ -1,5 +1,5 @@
/*
* UTCB handling common helper routines
* UTCB handling common helper routines.
*
* Copyright (C) 2009 B Labs Ltd.
*/

View File

@@ -1,5 +1,5 @@
/*
* UTCB handling helper routines
* UTCB handling helper routines.
*
* Copyright (C) 2009 B Labs Ltd.
*/
@@ -8,7 +8,10 @@
#include <tcb.h>
unsigned long get_utcb_addr(struct l4t_tcb *task);
int delete_utcb_addr(struct l4t_tcb *task);
/* Checks if l4_set_stack_params is called. */
#define IS_UTCB_SETUP() (lib_utcb_range_size)
unsigned long get_utcb_addr(struct tcb *task);
int delete_utcb_addr(struct tcb *task);
#endif /* __LIB_UTCB_H__ */