-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocess.h
36 lines (30 loc) · 896 Bytes
/
process.h
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
#ifndef PROCESS_H
#define PROCESS_H
typedef enum process_state {READY, RUNNING} process_state_t;
/*
This structure is intended to store snapshots of the
x86 registers used by a process
*/
typedef struct process_context {
int eax, ecx, edx, ebx, esp, ebp, esi, edi, eip;
} process_context_t;
/*
This structure represents a Process Control Block (PCB)
which will be an entry in the processes table
*/
typedef struct process {
int pid;
process_context_t context;
process_state_t state;
int *base_address; // address of the process code starting point
} process_t;
process_t *processes[15];
int process_count, curr_pid;
void process_init(); // called by the kernel when it starts
process_t* create_process(int *);
/*
parameters of create_process:
1- Pointer to the base address of the process
2- Pointer to the process control block
*/
#endif