BSD 4_1_snap development
[unix-history] / sys / h / map.h
CommitLineData
6bafdb92
C
1/* map.h 4.5 81/02/28 */
2
3/*
4 * Resource Allocation Maps.
5 *
6 * Associated routines manage sub-allocation of an address space using
7 * an array of segment descriptors. The first element of this array
8 * is a map structure, describing the arrays extent and the name
9 * of the controlled object. Each additional structure represents
10 * a free segment of the address space.
11 *
12 * A call to rminit initializes a resource map and may also be used
13 * to free some address space for the map. Subsequent calls to rmalloc
14 * and rmfree allocate and free space in the resource map. If the resource
15 * map becomes too fragmented to be described in the available space,
16 * then some of the resource is discarded. This may lead to critical
17 * shortages, but is better than not checking (as the previous versions
18 * of these routines did) or giving up and calling panic(). The routines
19 * could use linked lists and call a memory allocator when they run
20 * out of space, but that would not solve the out of space problem when
21 * called at interrupt time.
22 *
23 * N.B.: The address 0 in the resource address space is not available
24 * as it is used internally by the resource map routines.
25 */
26struct map {
27 struct mapent *m_limit; /* address of last slot in map */
28 char *m_name; /* name of resource */
29/* we use m_name when the map overflows, in warning messages */
30};
31struct mapent
32{
33 int m_size; /* size of this segment of the map */
34 int m_addr; /* resource-space addr of start of segment */
35};
36
37#ifdef KERNEL
38struct map *swapmap;
39int nswapmap;
40struct map *argmap;
41#define ARGMAPSIZE 16
42struct map *kernelmap;
43#endif