summaryrefslogtreecommitdiffstats
path: root/proc/process.h
blob: 2757f6fe5591dec6290ba3619c44aa7987ac7727 (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_HAL_PROCESS_H
#define _JOVE_HAL_PROCESS_H 1

#include "hal/obj.h"
#include "lib/rbtree.h"

typedef uintmax_t pid_t;

enum pcb_state
{
    PCB_DEAD, PCB_READY, PCB_RUNNING, PCB_BLOCKED
};

struct pcb_mailbox
{
    jove_obj_t *obj;
    pid_t pid;
};

struct pcb_expected_header
{
    struct rbtree_node tree_node;
    struct process_control_block *sched_next;

    pid_t pid;
    jove_obj_t *rootdir;
    jove_obj_t *pagedir;
};

typedef struct process_control_block pcb_t;

jove_owned_obj_t *process_current(void);

void pcb_new(pcb_t *pcb);
/*Returns the process ID of the passed PCB. */
pid_t pcb_getpid(pcb_t *pcb);
/*Returns the root kernel object directory of this PCB. */
jove_obj_t *pcb_rootdir(pcb_t *pcb);

jove_obj_t *pcb_pagedir(pcb_t *pcb);

extern pcb_t *pcb_tree;

#endif