add: TRACE(("vm_copy_on_write_area(area = %p)\n", area));
context: vm_copy_on_write_area(vm_area *area){	vm_store *store;	vm_cache *upperCache, *lowerCache;	vm_cache_ref *upperCacheRef, *lowerCacheRef;	vm_translation_map *map;	vm_page *page;	uint32 protection;	status_t status;	// We need to separate the vm_cache from its vm_cache_ref: the area	// and its cache_ref goes into a new layer on top of the old one.	// So the old cache gets a new cache_ref and the area a new cache.	upperCacheRef = area->cache_ref;	lowerCache = upperCacheRef->cache;	// create an anonymous store object	store = vm_store_create_anonymous_noswap(false, 0);	if (store == NULL)		return B_NO_MEMORY;	upperCache = vm_cache_create(store);	if (upperCache == NULL) {		status = B_NO_MEMORY;		goto err1;	}	lowerCacheRef = vm_cache_ref_create(lowerCache);	if (lowerCacheRef == NULL) {		status = B_NO_MEMORY;		goto err2;	}	// The area must be readable in the same way it was previously writable	protection = B_KERNEL_READ_AREA;	if (area->protection & B_READ_AREA)		protection |= B_READ_AREA;	// we need to hold the cache_ref lock when we want to switch its cache	mutex_lock(&upperCacheRef->lock);	mutex_lock(&lowerCacheRef->lock);	// ToDo: add a child counter to vm_cache - so that we can collapse a	//		cache layer when possible (ie. "the other" area was deleted)	upperCache->temporary = 1;	upperCache->scan_skip = lowerCache->scan_skip;	upperCache->source = lowerCache;	upperCache->ref = upperCacheRef;	upperCacheRef->cache = upperCache;	// we need to manually alter the ref_count	lowerCacheRef->ref_count = upperCacheRef->ref_count;	upperCacheRef->ref_count = 1;	// grab a ref to the cache object we're now linked to as a source	vm_cache_acquire_ref(lowerCacheRef, true);	// We now need to remap all pages from the area read-only, so that	// a copy will be created on next write access	map = &area->aspace->translation_map;	map->ops->lock(map);	map->ops->unmap(map, area->base, area->base + area->size - 1);	for (page = lowerCache->page_list; page; page = page->cache_next) {		map->ops->map(map, area->base + page->offset, page->ppn * B_PAGE_SIZE, protection);	}	map->ops->unlock(map);	mutex_unlock(&lowerCacheRef->lock);	mutex_unlock(&upperCacheRef->lock);	return B_OK;err2:	free(upperCache);err1:	store->ops->destroy(store);	return status;}