-
Notifications
You must be signed in to change notification settings - Fork 0
/
vas.h
73 lines (52 loc) · 1.03 KB
/
vas.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
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
/*
* vas.h
*
*/
#ifndef VAS_H_
#define VAS_H_
//#include "proc.h"
#include "seg.h"
class hat_t;
struct proc;
//Virtual address space for process
class vas_t {
public:
static vas_t* alloc();
void free();
seg_t* segat(int addr);
vas_t* dup();
int addseg(seg_t* newseg);
faultcode_t fault(int addr, uint size, enum fault_type type, enum seg_rw rw);
int map(int addr, uint size);
int unmap(int addr, uint size);
void dumpseg();
public:
void init() {
segs = 0;
seglast = 0;
size = 0;
rss = 0;
//hat = 0;
}
public:
int gap(uint minlen, int *basep, uint *lenp, int flags, int addr);
public:
uint lock:1;
uint want:1;
uint paglck:1;
uint :13;
seg_t* segs;
seg_t* seglast;
size_t size;
size_t rss;
struct proc* p;
hat_t* hat;
};
/*
* Flags for as_gap.
*/
#define AH_DIR 0x1 /* direction flag mask */
#define AH_LO 0x0 /* find lowest hole */
#define AH_HI 0x1 /* find highest hole */
#define AH_CONTAIN 0x2 /* hole must contain `addr' */
#endif /* VAS_H_ */