rem: return B_NO_ERROR;
add: return B_OK;
context: find_and_insert_region_slot(vm_virtual_map *map, addr_t start, addr_t size, addr_t end, int addr_type, vm_region *region){	vm_region *last_r = NULL;	vm_region *next_r;	bool foundspot = false;	TRACE(("find_and_insert_region_slot: map %p, start 0x%lx, size %ld, end 0x%lx, addr_type %d, region %p\n",		map, start, size, end, addr_type, region));//	dprintf("map->base 0x%x, map->size 0x%x\n", map->base, map->size);	// do some sanity checking	if (start < map->base || size == 0 || (end - 1) > (map->base + (map->size - 1)) || start + size > end)		return ERR_VM_BAD_ADDRESS;	// walk up to the spot where we should start searching	next_r = map->region_list;	while (next_r) {		if (next_r->base >= start + size) {			// we have a winner			break;		}		last_r = next_r;		next_r = next_r->aspace_next;	}#if 0	dprintf("last_r 0x%x, next_r 0x%x\n", last_r, next_r);	if(last_r) dprintf("last_r->base 0x%x, last_r->size 0x%x\n", last_r->base, last_r->size);	if(next_r) dprintf("next_r->base 0x%x, next_r->size 0x%x\n", next_r->base, next_r->size);#endif	switch (addr_type) {		case B_ANY_ADDRESS:		case B_ANY_KERNEL_ADDRESS:		case B_ANY_KERNEL_BLOCK_ADDRESS:		case B_BASE_ADDRESS:			// find a hole big enough for a new region			if (!last_r) {				// see if we can build it at the beginning of the virtual map				if (!next_r || (next_r->base >= map->base + size)) {					foundspot = true;					region->base = map->base;					break;				}				last_r = next_r;				next_r = next_r->aspace_next;			}			// keep walking			while (next_r) {				if (next_r->base >= last_r->base + last_r->size + size) {					// we found a spot					foundspot = true;					region->base = last_r->base + last_r->size;					break;				}				last_r = next_r;				next_r = next_r->aspace_next;			}			if ((map->base + (map->size - 1)) >= (last_r->base + last_r->size + (size - 1))) {				// found a spot				foundspot = true;				region->base = last_r->base + last_r->size;				break;			}			break;		case B_EXACT_ADDRESS:		case B_EXACT_KERNEL_ADDRESS:			// see if we can create it exactly here			if (!last_r) {				if (!next_r || (next_r->base >= start + size)) {					foundspot = true;					region->base = start;					break;				}			} else {				if (next_r) {					if (last_r->base + last_r->size <= start && next_r->base >= start + size) {						foundspot = true;						region->base = start;						break;					}				} else {					if ((last_r->base + (last_r->size - 1)) <= start - 1) {						foundspot = true;						region->base = start;					}				}			}			break;		default:			return EINVAL;	}	if (!foundspot)		return ERR_VM_NO_REGION_SLOT;	region->size = size;	if (last_r) {		region->aspace_next = last_r->aspace_next;		last_r->aspace_next = region;	} else {		region->aspace_next = map->region_list;		map->region_list = region;	}	map->change_count++;	return B_NO_ERROR;}