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 questen has to be already mapped-in. There is some basic
infrastructure for utcb to support mapping but it is far from being complete.
MAPPING_ENABLE symbolic constant controls this behaviour.

There are also some minor fixes for the stack support and the utcb common helper
routines.
This commit is contained in:
Bora Sahin
2009-11-04 16:16:19 +02:00
parent 352cb2daaa
commit 55af5c83cb
8 changed files with 316 additions and 81 deletions

View File

@@ -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);

View File

@@ -6,6 +6,8 @@
#ifndef __LIB_THREAD_H__
#define __LIB_THREAD_H__
#include "utcb.h"
#define STACK_TOP_ADDR(stack) ((unsigned long)(stack))
#define STACK_BOTTOM_ADDR(stack) \
((unsigned long)((stack) + (sizeof(stack))))

View 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__ */

View File

@@ -3,23 +3,39 @@
*
* 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>
#include "utcb-common.h"
struct utcb_desc {
struct link list;
unsigned long utcb_base;
struct id_pool *slots;
#define UTCB_START_ADDR(utcb) ((unsigned long)(utcb))
#define UTCB_END_ADDR(utcb) \
((unsigned long)((utcb) + (sizeof(utcb))))
int set_utcb_params(unsigned long utcb_start_addr,
unsigned long utcb_end_addr);
//#define MAPPING_ENABLE
#if defined(MAPPING_ENABLE)
#define IS_UTCB_SETUP() (utcb_table_ptr)
struct utcb_entry *utcb_table_ptr;
struct utcb_entry {
struct utcb_desc *udesc;
unsigned long utcb_phys_base;
};
int utcb_pool_init(unsigned long utcb_start, unsigned long utcb_end);
unsigned long get_utcb_addr(struct task_ids *parent_id, struct task_ids *child_id);
#else /* !MAPPING_ENABLE */
unsigned long utcb_new_slot(struct utcb_desc *desc);
int utcb_delete_slot(struct utcb_desc *desc, unsigned long address);
#define IS_UTCB_SETUP() (udesc_ptr)
struct utcb_desc *utcb_new_desc(void);
int utcb_delete_desc(struct utcb_desc *desc);
struct utcb_desc *udesc_ptr;
#endif /* __UTCB_H__ */
unsigned long get_utcb_addr(void);
#endif /* MAPPING_ENABLE */
#endif /* __LIB_UTCB_H__ */