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