Repository navigation
Expand file tree
/
Copy pathpage_table.H
More file actions
executable file
·90 lines (67 loc) · 3.26 KB
/
Copy pathpage_table.H
File metadata and controls
executable file
·90 lines (67 loc) · 3.26 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
/*
File: page_table.H
Author: R. Bettati
Department of Computer Science
Texas A&M University
Date : 09/03/25
Description: Basic Paging.
*/
#ifndef _page_table_H_ // include file only once
#define _page_table_H_
/*--------------------------------------------------------------------------*/
/* DEFINES */
/*--------------------------------------------------------------------------*/
/* -- (none) -- */
/*--------------------------------------------------------------------------*/
/* INCLUDES */
/*--------------------------------------------------------------------------*/
#include "exceptions.H"
#include "frame_pool.H"
#include "paging_low.H"
/*--------------------------------------------------------------------------*/
/* FORWARDS */
/*--------------------------------------------------------------------------*/
/* -- (none) -- */
/*--------------------------------------------------------------------------*/
/* P A G E - T A B L E */
/*--------------------------------------------------------------------------*/
class PageTable {
private:
/* THESE MEMBERS ARE COMMON TO ENTIRE PAGING SUBSYSTEM */
static PageTable * current_page_table; /* pointer to currently loaded page table object */
static unsigned int paging_enabled; /* is paging turned on (i.e. are addresses logical)? */
static FramePool * kernel_mem_pool; /* Frame pool for the kernel memory */
static FramePool * process_mem_pool; /* Frame pool for the process memory */
static unsigned long shared_size; /* size of shared address space */
/* DATA FOR CURRENT PAGE TABLE */
//static unsigned long * page_directory; /* where is page directory located? */
//static unsigned long * page_table;
unsigned long * page_directory; /* where is page directory located? */
unsigned long * page_table;
public:
static const unsigned int PAGE_SIZE = FramePool::FRAME_SIZE; /* in bytes */
static const unsigned int ENTRIES_PER_PAGE = 1024; /* in entries, duh! */
static void init_paging(FramePool * _kernel_mem_pool,
FramePool * _process_mem_pool,
const unsigned long _shared_size);
/* Set the global parameters for the paging subsystem. */
PageTable();
/* Initializes a page table with a given location for the directory and the
page table proper.
NOTE: The PageTable object still needs to be stored somewhere! Probably it is best
to have it on the stack, as there is no memory manager yet...
NOTE2: It may also be simpler to create the first page table *before* paging
has been enabled.
*/
void load();
/* Makes the given page table the current table. This must be done once during
system startup and whenever the address space is switched (e.g. during
process switching). */
static void enable_paging();
/* Enable paging on the CPU. Typically, a CPU start with paging disabled, and
memory is accessed by addressing physical memory directly. After paging is
enabled, memory is addressed logically. */
static void handle_fault(REGS * _r);
/* The page fault handler. */
};
#endif