ppc: Implement arch_vm_translation_map_is_kernel_page_accessible()

This remedies "Current thread pointer [...] is an address we can't read from."
on entering KDL. Closes ticket #6163.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38293 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Andreas Färber 2010-08-21 02:12:25 +00:00
parent f290297bb6
commit edaaaae8cd

View File

@ -887,6 +887,20 @@ bool
arch_vm_translation_map_is_kernel_page_accessible(addr_t virtualAddress,
uint32 protection)
{
// TODO: Implement!
return false;
VMAddressSpace *addressSpace = VMAddressSpace::Kernel();
PPCVMTranslationMap* map = static_cast<PPCVMTranslationMap*>(
addressSpace->TranslationMap());
phys_addr_t physicalAddress;
uint32 flags;
if (map->Query(virtualAddress, &physicalAddress, &flags) != B_OK)
return false;
if ((flags & PAGE_PRESENT) == 0)
return false;
// present means kernel-readable, so check for writable
return (protection & B_KERNEL_WRITE_AREA) == 0
|| (flags & B_KERNEL_WRITE_AREA) != 0;
}