blob: 04118a9585aa8286a5e742e5c834522b3aa04e21 (
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
|
#ifndef _JOVE_TASKING_H
#define _JOVE_TASKING_H 1
#include "arch/page.h"
#include <stddef.h>
#include <stdbool.h>
#define KERNEL_STACKW 4096
typedef intmax_t tcbid_t;
typedef enum
{
TCB_RUNNING,
TCB_PAUSED,
TCB_DEAD
} tcb_state_t;
typedef struct task_control_block
{
tcbid_t id;
void *stack;
uintptr_t sp, ksp;
page_directory_t *pd;
tcb_state_t state;
int exit_code;
} tcb_t;
void tasking_setup(void);
tcb_t *tcb_new(void *ip, page_directory_t *pd);
void tcb_prepare(tcb_t *tcb, void *ip);
void tcb_kill(tcb_t *tcb, int code);
void tcb_switch(tcb_t *to);
void tcb_stack_push(tcb_t *tcb, void *data, size_t len);
void kexec(void *ip, int kargc, char **kargv, int kenvc, char **kenvp);
void *umode_stack_new(void);
#endif
|