aboutsummaryrefslogtreecommitdiff
path: root/include/apos/tcb.h
blob: 11e1b5adf7d9cc2dfed1cd825f1afc773606d3c6 (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
42
43
44
45
46
47
48
49
#ifndef APOS_TCB_H
#define APOS_TCB_H

#include <apos/mem_regions.h>
#include <apos/types.h>
#include <tcb.h> /* arch-specific data */

struct tcb {
	struct arch_tcbd tcbd;

	/* mapping data
	 * TODO: should mem_region_root be renamed mem_root or something? feels
	 * kind of clunky */
	struct mem_region_root sp_r;

	id_t tid;

	vm_t callback;

	vm_t proc_stack;
	vm_t proc_stack_top;

	vm_t call_stack;
	vm_t call_stack_top;

	/* entry point */
	vm_t entry;

	/* vm root branch */
	struct vm_branch *b_r;

	struct tcb *parent;
	struct tcb *next;
};

void init_tcbs();
void destroy_tcbs();

struct tcb *new_thread();
void destroy_thread(struct tcb *);

struct tcb *cur_tcb();
void use_tcb(struct tcb *);

struct tcb *get_tcb(id_t tid);

stat_t clone_tcb_maps(struct tcb *);

#endif /* APOS_TCB_H */