unmap_and_free_physical_pages(): Added missing check whether the page
mapping is actually present. This would have resulted in page 0 being freed over and over again, if we hadn't also incorrectly tried to look up the page by the virtual instead of the physical address. So we were actually freeing random pages. Fortunately the virtual addresses are kernel addresses, so that the affected pages lay beyond 2 GB and probably weren't used at this point yet. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34912 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2a857080f5
commit
cb8617c1d4
@ -2880,8 +2880,9 @@ unmap_and_free_physical_pages(vm_translation_map* map, addr_t start, addr_t end)
|
||||
addr_t physicalAddress;
|
||||
uint32 flags;
|
||||
|
||||
if (map->ops->query(map, current, &physicalAddress, &flags) == B_OK) {
|
||||
vm_page* page = vm_lookup_page(current / B_PAGE_SIZE);
|
||||
if (map->ops->query(map, current, &physicalAddress, &flags) == B_OK
|
||||
&& (flags & PAGE_PRESENT) != 0) {
|
||||
vm_page* page = vm_lookup_page(physicalAddress / B_PAGE_SIZE);
|
||||
if (page != NULL)
|
||||
vm_page_set_state(page, PAGE_STATE_FREE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user