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