ApertureOS
threads.h
Go to the documentation of this file.
1 #ifndef _THREAD_MANAGER_H_
2 #define _THREAD_MANAGER_H_
3 
4 #include "types.h"
5 #include "managers.h"
6 #include "idt.h"
7 
8 typedef struct Thread
9 {
10  struct Thread *next;
12  uint64_t* cr3;
13  uint32_t kstack;
14  uint32_t status;
16  uint32_t flags;
17  void *k_tls;
18  char FPU_state[KB(16)]; //Allocate extra space for alignment
19 } __attribute__((packed)) Thread;
20 
21 typedef enum
22 {
28 };
29 
30 void
31 ThreadMan_Setup(void);
32 
33 UID
35  int argc,
36  char** argv,
37  uint32_t flags);
38 
39 void
41 
42 void
44 
45 void
47 
48 UID
50 
51 void*
53 
54 void
55 ThreadMan_Yield(void);
56 
57 void
58 ThreadMan_Lock(void);
59 
60 void
61 ThreadMan_Unlock(void);
62 
63 void*
65 
66 #endif /* end of include guard: _THREAD_MANAGER_H_ */
struct Thread * next
Definition: threads.h:10
Definition: threads.h:25
Definition: idt.h:10
char FPU_state[KB(16)]
Definition: threads.h:18
uint64_t UID
Definition: types.h:8
void * k_tls
Definition: threads.h:17
UID ThreadMan_GetCurThreadID(void)
Definition: threads.c:404
Definition: threads.h:23
void ThreadMan_Yield(void)
Definition: threads.c:398
uint64_t * cr3
Definition: threads.h:12
void ThreadMan_Lock(void)
Definition: threads.c:431
void * ThreadMan_GetCurThreadTLS(void)
Definition: threads.c:410
UID uid
Definition: threads.h:15
Definition: threads.h:24
void ThreadMan_DeleteThread(UID id)
Definition: threads.c:373
void * ThreadMan_GetThreadTLS(UID id)
Definition: threads.c:416
void ThreadMan_StartThread(UID id)
Definition: threads.c:341
int(* ProcessEntryPoint)(int, char **)
Definition: types.h:13
void ThreadMan_Setup(void)
Definition: threads.c:20
Registers regs
Definition: threads.h:11
uint32_t flags
Definition: threads.h:16
uint32_t kstack
Definition: threads.h:13
#define KB(x)
Definition: types.h:26
uint32_t status
Definition: threads.h:14
void ThreadMan_ExitThread(UID id)
Definition: threads.c:357
Definition: threads.h:26
Definition: threads.h:27
void ThreadMan_Unlock(void)
Definition: threads.c:442
UID ThreadMan_CreateThread(ProcessEntryPoint entry, int argc, char **argv, uint32_t flags)
Definition: threads.c:176
Definition: threads.h:8