mirror of
https://github.com/drasko/codezero.git
synced 2026-02-27 09:13:13 +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 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:
@@ -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,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))))
|
||||
|
||||
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,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__ */
|
||||
|
||||
Reference in New Issue
Block a user