|
|
1.1 root 1: /*
2: * Copyright (c) 1982, 1986 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)cmap.h 7.1 (Berkeley) 6/4/86
7: */
8:
9: /*
10: * core map entry
11: *
12: * Limits imposed by this structure:
13: *
14: * limit cur. size fields
15: * Physical memory* 64 Mb c_next, c_prev, c_hlink
16: * Mounted filesystems 255 c_mdev
17: * size of a process segment 1 Gb c_page
18: * filesystem size 8 Gb c_blkno
19: * proc, text table size 64K c_ndx
20: *
21: * * memory can be expanded by converting first three entries
22: * to bit fields of larger than 16 bits, shrinking c_ndx accordingly,
23: * and increasing MAXMEM below. Also, the type of cmhash
24: * (below) must be changed to long.
25: */
26: #ifndef LOCORE
27: struct cmap
28: {
29: unsigned short c_next, /* index of next free list entry */
30: c_prev, /* index of previous free list entry */
31: c_hlink; /* hash link for <blkno,mdev> */
32: unsigned short c_ndx; /* index of owner proc or text */
33: unsigned int c_page:21, /* virtual page number in segment */
34: c_lock:1, /* locked for raw i/o or pagein */
35: c_want:1, /* wanted */
36: c_intrans:1, /* intransit bit */
37: c_free:1, /* on the free list */
38: c_gone:1, /* associated page has been released */
39: c_type:2, /* type CSYS or CTEXT or CSTACK or CDATA */
40: :4, /* to longword boundary */
41: c_blkno:24, /* disk block this is a copy of */
42: c_mdev:8; /* which mounted dev this is from */
43: };
44: #else LOCORE
45: /*
46: * bit offsets of elements in cmap
47: */
48: #define C_INTRANS 87
49: #define C_FREE 88
50: #define SZ_CMAP 16 /* sizeof(struct cmap) */
51:
52: #define MAXMEM 64*1024 /* maximum memory, in Kbytes */
53: #endif LOCORE
54:
55: #define CMHEAD 0
56:
57: /*
58: * Shared text pages are not totally abandoned when a process
59: * exits, but are remembered while in the free list hashed by <mdev,blkno>
60: * off the cmhash structure so that they can be reattached
61: * if another instance of the program runs again soon.
62: */
63: #define CMHSIZ 2048 /* SHOULD BE DYNAMIC */
64: #define CMHASH(bn) ((bn)&(CMHSIZ-1))
65:
66: #ifndef LOCORE
67: #ifdef KERNEL
68: struct cmap *cmap;
69: struct cmap *ecmap;
70: int ncmap;
71: struct cmap *mfind();
72: int firstfree, maxfree;
73: int ecmx; /* cmap index of ecmap */
74: u_short cmhash[CMHSIZ];
75: #endif
76:
77: /* bits defined in c_type */
78:
79: #define CSYS 0 /* none of below */
80: #define CTEXT 1 /* belongs to shared text segment */
81: #define CDATA 2 /* belongs to data segment */
82: #define CSTACK 3 /* belongs to stack segment */
83:
84: #define pgtocm(x) (((int) ((x)-firstfree) / CLSIZE) + 1)
85: #define cmtopg(x) ((((x)-1) * CLSIZE) + firstfree)
86: #endif LOCORE
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.