1 /* 2 * Copyright (c) 1982, 1986 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * from: @(#)subr_rmap.c 7.9 (Berkeley) 5/11/91 8 */ 9 10 #include "param.h" 11 #include "systm.h" 12 #include "map.h" 13 #include "dmap.h" /* XXX */ 14 #include "proc.h" 15 #include "kernel.h" 16 17 /* 18 * Resource map handling routines. 19 * 20 * A resource map is an array of structures each 21 * of which describes a segment of the address space of an available 22 * resource. The segments are described by their base address and 23 * length, and sorted in address order. Each resource map has a fixed 24 * maximum number of segments allowed. Resources are allocated 25 * by taking part or all of one of the segments of the map. 26 * 27 * Returning of resources will require another segment if 28 * the returned resources are not adjacent in the address 29 * space to an existing segment. If the return of a segment 30 * would require a slot which is not available, then one of 31 * the resource map segments is discarded after a warning is printed. 32 * Returning of resources may also cause the map to collapse 33 * by coalescing two existing segments and the returned space 34 * into a single segment. In this case the resource map is 35 * made smaller by copying together to fill the resultant gap. 36 * 37 * N.B.: the current implementation uses a dense array and does 38 * not admit the value ``0'' as a legal address, since that is used 39 * as a delimiter. 40 */ 41 42 /* 43 * Initialize map mp to have (mapsize-2) segments 44 * and to be called ``name'', which we print if 45 * the slots become so fragmented that we lose space. 46 * The map itself is initialized with size elements free 47 * starting at addr. 48 */ 49 rminit(mp, size, addr, name, mapsize) 50 register struct map *mp; 51 long size, addr; 52 char *name; 53 int mapsize; 54 { 55 56 /* 57 * Body deleted. 58 */ 59 return; 60 } 61 62 /* 63 * A piece of memory of at least size units is allocated from the 64 * specified map using a first-fit algorithm. It returns the starting 65 * address of the allocated space. 66 * 67 * This routine knows about and handles the interleaving of the swapmap. 68 */ 69 long 70 rmalloc(mp, size) 71 register struct map *mp; 72 long size; 73 { 74 75 /* 76 * Body deleted. 77 */ 78 return (0); 79 } 80 81 /* 82 * The previously allocated space at addr of size units is freed 83 * into the specified map. This routine is responsible for sorting 84 * the frred space into the correct location in the map, and coalescing 85 * it with free space on either side if they adjoin. 86 */ 87 rmfree(mp, size, addr) 88 struct map *mp; 89 long size, addr; 90 { 91 92 /* 93 * Body deleted. 94 */ 95 return; 96 } 97