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

This reverts commit 3f870b540f.
This commit is contained in:
Bahadir Balban
2009-11-05 19:17:36 +02:00
parent e28658c10e
commit f7565118f1
39 changed files with 65 additions and 1051 deletions

View File

@@ -1,27 +0,0 @@
/*
* Address allocation pool
*
* Copyright (C) 2007 Bahadir Balban
*/
#ifndef __ADDR_H__
#define __ADDR_H__
#include <idpool.h>
/* Address pool to allocate from a range of addresses */
struct address_pool {
struct id_pool *idpool;
unsigned long start;
unsigned long end;
};
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 size);
void *address_new(struct address_pool *pool, int npages);
int address_del(struct address_pool *, void *addr, int npages);
#endif /* __ADDR_H__ */

View File

@@ -1,42 +0,0 @@
#ifndef __BIT_H__
#define __BIT_H__
unsigned int __clz(unsigned int bitvector);
int find_and_set_first_free_bit(u32 *word, unsigned int lastbit);
int find_and_set_first_free_contig_bits(u32 *word, unsigned int limit,
int nbits);
int check_and_clear_bit(u32 *word, int bit);
int check_and_clear_contig_bits(u32 *word, int first, int nbits);
int check_and_set_bit(u32 *word, int bit);
/* Set */
static inline void setbit(unsigned int *w, unsigned int flags)
{
*w |= flags;
}
/* Clear */
static inline void clrbit(unsigned int *w, unsigned int flags)
{
*w &= ~flags;
}
/* Test */
static inline int tstbit(unsigned int *w, unsigned int flags)
{
return *w & flags;
}
/* Test and clear */
static inline int tstclr(unsigned int *w, unsigned int flags)
{
int res = tstbit(w, flags);
clrbit(w, flags);
return res;
}
#endif /* __BIT_H__ */

View File

@@ -1,30 +0,0 @@
#ifndef __IDPOOL_H__
#define __IDPOOL_H__
#include <bit.h>
#include <string.h>
#include INC_GLUE(memory.h)
struct id_pool {
int nwords;
int bitlimit;
u32 bitmap[];
};
/* Copy one id pool to another by calculating its size */
static inline void id_pool_copy(struct id_pool *to, struct id_pool *from, int totalbits)
{
int nwords = BITWISE_GETWORD(totalbits);
memcpy(to, from, nwords * SZ_WORD + sizeof(struct id_pool));
}
struct id_pool *id_pool_new_init(int mapsize);
int id_new(struct id_pool *pool);
int id_del(struct id_pool *pool, int id);
int id_get(struct id_pool *pool, int id);
int id_is_empty(struct id_pool *pool);
int ids_new_contiguous(struct id_pool *pool, int numids);
int ids_del_contiguous(struct id_pool *pool, int first, int numids);
#endif /* __IDPOOL_H__ */

View File

@@ -1,21 +0,0 @@
/*
* Thread creation userspace helpers
*
* Copyright (C) 2009 B Labs Ltd.
*/
#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))))
int set_stack_params(unsigned long stack_top_addr,
unsigned long stack_bottom_addr,
unsigned long stack_size);
int thread_create(struct task_ids *ids, unsigned int flags,
int (*func)(void *), void *arg);
#endif /* __LIB_THREAD_H__ */

View File

@@ -1,25 +0,0 @@
/*
* 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

@@ -1,41 +0,0 @@
/*
* UTCB handling helper routines
*
* Copyright (C) 2009 B Labs Ltd.
*/
#ifndef __LIB_UTCB_H__
#define __LIB_UTCB_H__
#include "utcb-common.h"
#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;
};
unsigned long get_utcb_addr(struct task_ids *parent_id, struct task_ids *child_id);
#else /* !MAPPING_ENABLE */
#define IS_UTCB_SETUP() (udesc_ptr)
struct utcb_desc *udesc_ptr;
unsigned long get_utcb_addr(void);
#endif /* MAPPING_ENABLE */
#endif /* __LIB_UTCB_H__ */