When switching to PAE don't copy not needed PTEs
Now we check whether the virtual address corresponding to the PTE lies in an allocated virtual address range. This fixes a cause of #8345: The assertion would trigger when such an entry was encountered. There might be other causes that trigger the same assertion, though.
This commit is contained in:
@@ -195,7 +195,8 @@ private:
|
||||
pae_page_table_entry* paeEntry = paeTable;
|
||||
for (uint32 i = 0; i < kPAEPageTableEntryCount;
|
||||
i++, entry++, paeEntry++) {
|
||||
if ((*entry & X86_PTE_PRESENT) != 0) {
|
||||
if ((*entry & X86_PTE_PRESENT) != 0
|
||||
&& _IsVirtualAddressAllocated(virtualBase + i * B_PAGE_SIZE)) {
|
||||
// Note, we use the fact that the PAE flags are defined to the
|
||||
// same values.
|
||||
*paeEntry = *entry & (X86_PTE_PRESENT
|
||||
@@ -311,6 +312,20 @@ private:
|
||||
return page;
|
||||
}
|
||||
|
||||
bool _IsVirtualAddressAllocated(addr_t address) const
|
||||
{
|
||||
for (uint32 i = 0; i < fKernelArgs->num_virtual_allocated_ranges; i++) {
|
||||
addr_t start = fKernelArgs->virtual_allocated_range[i].start;
|
||||
addr_t end = start + fKernelArgs->virtual_allocated_range[i].size;
|
||||
if (address < start)
|
||||
return false;
|
||||
if (address <= end - 1)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
kernel_args* fKernelArgs;
|
||||
page_table_entry* fPageHole;
|
||||
|
||||
Reference in New Issue
Block a user