-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpageint.c
More file actions
107 lines (68 loc) · 3.49 KB
/
pageint.c
File metadata and controls
107 lines (68 loc) · 3.49 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/****************************************************************************/
/* */
/* Module PAGEINT */
/* External Declarations */
/* */
/****************************************************************************/
/* external define constants */
#define MAX_PAGE 16 /* max size of page tables */
/* external enumeration constants */
typedef enum {
false, true /* the boolean data type */
} BOOL;
typedef enum {
running, ready, waiting, done /* types of status */
} STATUS;
/* external type definitions */
typedef struct pcb_node PCB;
typedef struct page_entry_node PAGE_ENTRY;
typedef struct page_tbl_node PAGE_TBL;
typedef struct event_node EVENT;
/* external data structures */
struct page_entry_node {
int frame_id; /* frame id holding this page */
BOOL valid; /* page in main memory : valid = true; not : false */
BOOL ref; /* set to true every time page is referenced AD */
int *hook; /* can hook up anything here */
};
struct page_tbl_node {
PCB *pcb; /* PCB of the process in question */
PAGE_ENTRY page_entry[MAX_PAGE];
int *hook; /* can hook up anything here */
};
struct pcb_node {
int pcb_id; /* PCB id */
int size; /* process size in bytes; assigned by SIMCORE */
int creation_time; /* assigned by SIMCORE */
int last_dispatch; /* last time the process was dispatched */
int last_cpuburst; /* length of the previous cpu burst */
int accumulated_cpu;/* accumulated CPU time */
PAGE_TBL *page_tbl; /* page table associated with the PCB */
STATUS status; /* status of process */
EVENT *event; /* event upon which process may be suspended */
int priority; /* user-defined priority; used for scheduling */
PCB *next; /* next pcb in whatever queue */
PCB *prev; /* previous pcb in whatever queue */
int *hook; /* can hook up anything here */
};
/* external variables */
extern PAGE_TBL *PTBR; /* page table base register */
/* external routines */
extern get_page(/* pcb, page_id */);
/* PCB *pcb;
int page_id; */
/****************************************************************************/
/* */
/* */
/* Module PAGEINT */
/* Internal Routines */
/* */
/* */
/****************************************************************************/
void pagefault_handler(pcb, page_id)
PCB *pcb;
int page_id;
{
get_page(pcb, page_id);
}
/* end of module */