xref: /original-bsd/sys/sys/map.h (revision 4cda19ca)
1 /*-
2  * Copyright (c) 1982, 1986, The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)map.h	7.3 (Berkeley) 02/15/91
8  */
9 
10 /*
11  * Resource allocation maps.
12  *
13  * Associated routines manage sub-allocation of an address space using
14  * an array of segment descriptors.  The first element of this array
15  * is a map structure, describing the arrays extent and the name
16  * of the controlled object.  Each additional structure represents
17  * a free segment of the address space.
18  *
19  * A call to rminit initializes a resource map and may also be used
20  * to free some address space for the map.  Subsequent calls to rmalloc
21  * and rmfree allocate and free space in the resource map.  If the resource
22  * map becomes too fragmented to be described in the available space,
23  * then some of the resource is discarded.  This may lead to critical
24  * shortages, but is better than not checking (as the previous versions
25  * of these routines did) or giving up and calling panic().  The routines
26  * could use linked lists and call a memory allocator when they run
27  * out of space, but that would not solve the out of space problem when
28  * called at interrupt time.
29  *
30  * N.B.: The address 0 in the resource address space is not available
31  * as it is used internally by the resource map routines.
32  */
33 struct map {
34 	struct mapent *m_limit;	/* address of last slot in map */
35 	char *m_name;		/* name of resource, for messages */
36 };
37 struct mapent {
38 	int m_size;		/* size of this segment of the map */
39 	int m_addr;		/* resource-space addr of start of segment */
40 };
41 
42 #ifdef KERNEL
43 #define	ARGMAPSIZE	16
44 struct map *argmap, *kernelmap, *kmemmap, *mbmap, *swapmap;
45 int nswapmap;
46 #endif
47