mirror of
https://github.com/drasko/codezero.git
synced 2026-02-22 23:03:14 +01:00
The second step in creating a thread library.
UTCB support has beed added. It has the same drawback as in the stack support: the area in question has to be already mapped-in. There are also some minor fixes for the stack support and the utcb common helper routines.
This commit is contained in:
@@ -18,8 +18,9 @@ struct address_pool {
|
||||
int address_pool_init_with_idpool(struct address_pool *pool,
|
||||
struct id_pool *idpool,
|
||||
unsigned long start, unsigned long end);
|
||||
int address_pool_init(struct address_pool *pool, unsigned long start,
|
||||
unsigned long end);
|
||||
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);
|
||||
|
||||
|
||||
@@ -6,13 +6,21 @@
|
||||
#ifndef __LIB_THREAD_H__
|
||||
#define __LIB_THREAD_H__
|
||||
|
||||
#define STACK_TOP_ADDR(stack) ((unsigned long)(stack))
|
||||
#define STACK_BOTTOM_ADDR(stack) \
|
||||
((unsigned long)((stack) + (sizeof(stack))))
|
||||
#define START_ADDR(addr) ((unsigned long)(addr))
|
||||
#define END_ADDR(addr) ((unsigned long)((addr) + (sizeof(addr))))
|
||||
|
||||
#define STACK_TOP_ADDR(stack) (START_ADDR(stack))
|
||||
#define STACK_BOTTOM_ADDR(stack) (END_ADDR(stack))
|
||||
|
||||
#define UTCB_START_ADDR(utcb) (START_ADDR(utcb))
|
||||
#define UTCB_END_ADDR(utcb) (END_ADDR(utcb))
|
||||
|
||||
int set_stack_params(unsigned long stack_top_addr,
|
||||
unsigned long stack_bottom_addr,
|
||||
unsigned long stack_size);
|
||||
int set_utcb_params(unsigned long utcb_start_addr,
|
||||
unsigned long utcb_end_addr);
|
||||
|
||||
int thread_create(struct task_ids *ids, unsigned int flags,
|
||||
int (*func)(void *), void *arg);
|
||||
|
||||
|
||||
25
conts/libl4thread/include/l4thread/utcb-common.h
Normal file
25
conts/libl4thread/include/l4thread/utcb-common.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* UTCB handling common helper routines
|
||||
*
|
||||
* Copyright (C) 2009 B Labs Ltd.
|
||||
*/
|
||||
#ifndef __UTCB_COMMON_H__
|
||||
#define __UTCB_COMMON_H__
|
||||
|
||||
#include <l4/lib/list.h>
|
||||
|
||||
struct utcb_desc {
|
||||
struct link list;
|
||||
unsigned long utcb_base;
|
||||
struct id_pool *slots;
|
||||
};
|
||||
|
||||
int utcb_pool_init(unsigned long utcb_start, unsigned long utcb_end);
|
||||
|
||||
unsigned long utcb_new_slot(struct utcb_desc *desc);
|
||||
int utcb_delete_slot(struct utcb_desc *desc, unsigned long address);
|
||||
|
||||
struct utcb_desc *utcb_new_desc(void);
|
||||
int utcb_delete_desc(struct utcb_desc *desc);
|
||||
|
||||
#endif /* __UTCB_COMMON_H__ */
|
||||
@@ -3,23 +3,13 @@
|
||||
*
|
||||
* Copyright (C) 2009 B Labs Ltd.
|
||||
*/
|
||||
#ifndef __UTCB_H__
|
||||
#define __UTCB_H__
|
||||
#ifndef __LIB_UTCB_H__
|
||||
#define __LIB_UTCB_H__
|
||||
|
||||
#include <l4/lib/list.h>
|
||||
#define IS_UTCB_SETUP() (udesc_ptr)
|
||||
|
||||
struct utcb_desc {
|
||||
struct link list;
|
||||
unsigned long utcb_base;
|
||||
struct id_pool *slots;
|
||||
};
|
||||
struct utcb_desc *udesc_ptr;
|
||||
|
||||
int utcb_pool_init(unsigned long utcb_start, unsigned long utcb_end);
|
||||
unsigned long get_utcb_addr(void);
|
||||
|
||||
unsigned long utcb_new_slot(struct utcb_desc *desc);
|
||||
int utcb_delete_slot(struct utcb_desc *desc, unsigned long address);
|
||||
|
||||
struct utcb_desc *utcb_new_desc(void);
|
||||
int utcb_delete_desc(struct utcb_desc *desc);
|
||||
|
||||
#endif /* __UTCB_H__ */
|
||||
#endif /* __LIB_UTCB_H__ */
|
||||
|
||||
Reference in New Issue
Block a user