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