mirror of
https://github.com/drasko/codezero.git
synced 2026-01-13 19:33:15 +01:00
Task list is introduced to the thread library.
In order to do resource recycling we need a table structure. In the search of one, we concluded that a task list will make things easier when we start adding COPY and NEW space handling. This commit is for utcb recycling. Now, it does not support thread trees more than one level depth. Thus, to be able to test it, we preferred l4thread_destroy instead of l4thread_exit.
This commit is contained in:
35
conts/libl4thread/include/l4thread/tcb.h
Normal file
35
conts/libl4thread/include/l4thread/tcb.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Thread control block.
|
||||
*
|
||||
* Copyright (C) 2009 B Labs Ltd.
|
||||
*/
|
||||
#ifndef __LIB_TCB_H__
|
||||
#define __LIB_TCB_H__
|
||||
|
||||
#include <l4/lib/list.h>
|
||||
|
||||
/* Keeps all the struct utcb_descs belonging to a thread group together. */
|
||||
struct utcb_head {
|
||||
struct link list;
|
||||
};
|
||||
|
||||
/* A simple thread control block for the thread library. */
|
||||
struct l4t_tcb {
|
||||
struct link list;
|
||||
int tid;
|
||||
struct utcb_head *utcb_head;
|
||||
unsigned long utcb_addr;
|
||||
};
|
||||
|
||||
/* This struct keeps track of all the threads handled by the thread lib. */
|
||||
struct l4t_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);
|
||||
|
||||
#endif /* __LIB_TCB_H__ */
|
||||
@@ -13,5 +13,6 @@ int set_utcb_params(unsigned long utcb_start, unsigned long utcb_end);
|
||||
|
||||
int l4thread_create(struct task_ids *ids, unsigned int flags,
|
||||
int (*func)(void *), void *arg);
|
||||
void l4thread_kill(struct task_ids *ids);
|
||||
|
||||
#endif /* __LIB_THREAD_H__ */
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
#ifndef __LIB_UTCB_H__
|
||||
#define __LIB_UTCB_H__
|
||||
|
||||
#define IS_UTCB_SETUP() (udesc_ptr)
|
||||
#include <tcb.h>
|
||||
|
||||
struct utcb_desc *udesc_ptr;
|
||||
|
||||
unsigned long get_utcb_addr(void);
|
||||
unsigned long get_utcb_addr(struct l4t_tcb *task);
|
||||
int delete_utcb_addr(struct l4t_tcb *task);
|
||||
|
||||
#endif /* __LIB_UTCB_H__ */
|
||||
|
||||
Reference in New Issue
Block a user