Commit | Line | Data |
---|---|---|
6bafdb92 C |
1 | /* cmap.h 4.5 81/03/09 */ |
2 | ||
3 | /* | |
4 | * core map entry | |
5 | */ | |
6 | struct cmap | |
7 | { | |
8 | unsigned int c_next:13, /* index of next free list entry */ | |
9 | c_prev:13, /* index of previous free list entry */ | |
10 | c_mdev:4, /* which mounted dev this is from */ | |
11 | c_lock:1, /* locked for raw i/o or pagein */ | |
12 | c_want:1, /* wanted */ | |
13 | c_page:16, /* virtual page number in segment */ | |
14 | c_hlink:13, /* hash link for <blkno,mdev> */ | |
15 | c_intrans:1, /* intransit bit */ | |
16 | c_free:1, /* on the free list */ | |
17 | c_gone:1, /* associated page has been released */ | |
18 | c_type:2, /* type CSYS or CTEXT or CSTACK or CDATA */ | |
19 | c_blkno:20, /* disk block this is a copy of */ | |
20 | c_ndx:10; /* index of owner proc or text */ | |
21 | }; | |
22 | ||
23 | #define CMHEAD 0 | |
24 | ||
25 | /* | |
26 | * Shared text pages are not totally abandoned when a process | |
27 | * exits, but are remembered while in the free list hashed by <mdev,blkno> | |
28 | * off the cmhash structure so that they can be reattached | |
29 | * if another instance of the program runs again soon. | |
30 | */ | |
31 | #define CMHSIZ 512 /* SHOULD BE DYNAMIC */ | |
32 | #define CMHASH(bn) ((bn)&(CMHSIZ-1)) | |
33 | ||
34 | #ifdef KERNEL | |
35 | struct cmap *cmap; | |
36 | struct cmap *ecmap; | |
37 | int ncmap; | |
38 | struct cmap *mfind(); | |
39 | int firstfree, maxfree; | |
40 | int ecmx; /* cmap index of ecmap */ | |
41 | short cmhash[CMHSIZ]; | |
42 | #endif | |
43 | ||
44 | /* bits defined in c_type */ | |
45 | ||
46 | #define CSYS 0 /* none of below */ | |
47 | #define CTEXT 1 /* belongs to shared text segment */ | |
48 | #define CDATA 2 /* belongs to data segment */ | |
49 | #define CSTACK 3 /* belongs to stack segment */ | |
50 | ||
51 | #define pgtocm(x) ((((x)-firstfree) / CLSIZE) + 1) | |
52 | #define cmtopg(x) ((((x)-1) * CLSIZE) + firstfree) |