Only the to be protected range needs to be non-wired.
When setting memory protection, only ensure/wait for the range that needs to be protected to not be wired instead of requiering the whole area to be non-wired. The memory protection is done page wise and having some parts of the area wired shouldn't preclude other parts to be protected.
This commit is contained in:
parent
62bb375688
commit
ded69b4c3a
@ -6261,15 +6261,6 @@ _user_set_memory_protection(void* _address, size_t size, uint32 protection)
|
||||
if ((area->protection & B_KERNEL_AREA) != 0)
|
||||
return B_NOT_ALLOWED;
|
||||
|
||||
AreaCacheLocker cacheLocker(area);
|
||||
|
||||
if (wait_if_area_is_wired(area, &locker, &cacheLocker)) {
|
||||
restart = true;
|
||||
break;
|
||||
}
|
||||
|
||||
cacheLocker.Unlock();
|
||||
|
||||
// TODO: For (shared) mapped files we should check whether the new
|
||||
// protections are compatible with the file permissions. We don't
|
||||
// have a way to do that yet, though.
|
||||
@ -6277,6 +6268,16 @@ _user_set_memory_protection(void* _address, size_t size, uint32 protection)
|
||||
addr_t offset = currentAddress - area->Base();
|
||||
size_t rangeSize = min_c(area->Size() - offset, sizeLeft);
|
||||
|
||||
AreaCacheLocker cacheLocker(area);
|
||||
|
||||
if (wait_if_area_range_is_wired(area, currentAddress, rangeSize,
|
||||
&locker, &cacheLocker)) {
|
||||
restart = true;
|
||||
break;
|
||||
}
|
||||
|
||||
cacheLocker.Unlock();
|
||||
|
||||
currentAddress += rangeSize;
|
||||
sizeLeft -= rangeSize;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user