diff options
Diffstat (limited to 'proc')
| -rw-r--r-- | proc/process.c | 8 | ||||
| -rw-r--r-- | proc/process.h | 38 |
2 files changed, 46 insertions, 0 deletions
diff --git a/proc/process.c b/proc/process.c new file mode 100644 index 0000000..3687c8a --- /dev/null +++ b/proc/process.c @@ -0,0 +1,8 @@ +#include "process.h" +#include "hal/smp.h" + +jove_owned_obj_t* +process_current(void) +{ + return processor_pcb(((processor_t*)processor_current())); +} diff --git a/proc/process.h b/proc/process.h new file mode 100644 index 0000000..5099476 --- /dev/null +++ b/proc/process.h @@ -0,0 +1,38 @@ +#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; +}; + +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_pid(pcb_t *pcb); +/*Returns the root kernel object directory of this PCB. */ +jove_obj_t *pcb_rootdir(pcb_t *pcb); + +extern pcb_t *_init_pcb; + +#endif |
