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