aboutsummaryrefslogtreecommitdiff
path: root/include/apos/tcb.h
blob: 0a07d7b8a002926e0022b943cac9c2f76d49e875 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef APOS_TCB_H
#define APOS_TCB_H

struct tcb;
struct sp_reg_root;

#include <tcb.h>
#include <vmem.h>
#include <apos/vmem.h>
#include <apos/types.h>
#include <apos/sp_tree.h>

typedef size_t id_t;

struct sp_reg_root {
	struct sp_root free_regions;
	struct sp_root used_regions;
};

struct tcb {
	struct sp_node sp_n;
	struct sp_reg_root sp_r;
	struct arch_tcbd tcbd;

	id_t pid;
	id_t tid;

	vm_t callback;
	vm_t proc_stack;
	vm_t call_stack;

	vm_t entry;

	struct vm_branch *b_r;
};

void threads_insert(struct tcb *t);
struct tcb *cur_tcb();
struct tcb *get_tcb(id_t tid);

#endif /* APOS_TCB_H */