rem: (areaInfo.protection & ~B_EXECUTE_AREA) | B_KERNEL_WRITE_AREA);
add: areaInfo.protection | B_WRITE_AREA);
context: write_user_memory(void *_address, const void *_buffer, int32 size,	int32 &bytesWritten){	char *address = (char*)_address;	const char *buffer = (const char*)_buffer;	// check the parameters	if (!IS_USER_ADDRESS(address))		return B_BAD_ADDRESS;	if (size <= 0)		return B_BAD_VALUE;	// If the region to be written crosses area boundaries, we split it up into	// smaller chunks.	status_t error = B_OK;	bytesWritten = 0;	while (size > 0) {		int32 toWrite = size;		// get the area for the address (we need to use _user_area_for(), since		// we're looking for a user area)		area_id area = _user_area_for((void*)address);		if (area < 0) {			TRACE(("write_user_memory(): area not found for address: %p: "				"%lx\n", address, area));			error = area;			break;		}		area_info areaInfo;		status_t error = get_area_info(area, &areaInfo);		if (error != B_OK) {			TRACE(("write_user_memory(): failed to get info for area %ld: "				"%lx\n", area, error));			error = B_BAD_ADDRESS;			break;		}		// restrict this round of writing to the found area		if (address + toWrite > (char*)areaInfo.address + areaInfo.size)			toWrite = (char*)areaInfo.address + areaInfo.size - address;		// if the area is read-only, we temporarily need to make it writable		bool protectionChanged = false;		if (!(areaInfo.protection & (B_WRITE_AREA | B_KERNEL_WRITE_AREA))) {			error = set_area_protection(area,//				areaInfo.protection | B_KERNEL_WRITE_AREA);(areaInfo.protection & ~B_EXECUTE_AREA) | B_KERNEL_WRITE_AREA);// TODO: Not being writable when being executable is currently a requirement// of vm_set_area_protection().			if (error != B_OK) {				TRACE(("write_user_memory(): failed to set new protection for "					"area %ld: %lx\n", area, error));				break;			}			protectionChanged = true;		}		// copy the memory		error = user_memcpy(address, buffer, toWrite);		// reset the area protection		if (protectionChanged)			set_area_protection(area, areaInfo.protection);		if (error != B_OK) {			TRACE(("write_user_memory(): user_memcpy() failed: %lx\n", error));			break;		}		bytesWritten += toWrite;		address += toWrite;		buffer += toWrite;		size -= toWrite;	}	// If writing fails, we only fail, if we haven't written anything yet.	if (error != B_OK) {		if (bytesWritten > 0)			return B_OK;		return error;	}	return B_OK;}