* large_memory_physical_page_ops_init(): Don't assign the return value before

it is fully initialized.
* arch_vm_translation_map_is_kernel_page_accessible(): Check whether
  sPhysicalPageMapper has already been initialized.

If a panic() during or before the initialization of the physical page mapper
occurred, we no longer access a partially initialized object or a NULL pointer.
This should fix the triple fault part of #1925.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35644 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2010-02-27 21:20:29 +00:00
parent dcd2d7c4a7
commit 4891bed4d2
2 changed files with 7 additions and 4 deletions

View File

@ -1446,7 +1446,7 @@ arch_vm_translation_map_is_kernel_page_accessible(addr_t virtualAddress,
if (physicalPageDirectory == (addr_t)sKernelPhysicalPageDirectory) { if (physicalPageDirectory == (addr_t)sKernelPhysicalPageDirectory) {
pageDirectoryEntry = sKernelVirtualPageDirectory[index]; pageDirectoryEntry = sKernelVirtualPageDirectory[index];
} else { } else if (sPhysicalPageMapper != NULL) {
// map the original page directory and get the entry // map the original page directory and get the entry
void* handle; void* handle;
addr_t virtualPageDirectory; addr_t virtualPageDirectory;
@ -1459,13 +1459,15 @@ arch_vm_translation_map_is_kernel_page_accessible(addr_t virtualAddress,
handle); handle);
} else } else
pageDirectoryEntry = 0; pageDirectoryEntry = 0;
} } else
pageDirectoryEntry = 0;
// map the page table and get the entry // map the page table and get the entry
page_table_entry pageTableEntry; page_table_entry pageTableEntry;
index = VADDR_TO_PTENT(virtualAddress); index = VADDR_TO_PTENT(virtualAddress);
if ((pageDirectoryEntry & X86_PDE_PRESENT) != 0) { if ((pageDirectoryEntry & X86_PDE_PRESENT) != 0
&& sPhysicalPageMapper != NULL) {
void* handle; void* handle;
addr_t virtualPageTable; addr_t virtualPageTable;
status_t error = sPhysicalPageMapper->GetPageDebug( status_t error = sPhysicalPageMapper->GetPageDebug(

View File

@ -918,8 +918,9 @@ large_memory_physical_page_ops_init(kernel_args* args,
X86PhysicalPageMapper*& _pageMapper, X86PhysicalPageMapper*& _pageMapper,
TranslationMapPhysicalPageMapper*& _kernelPageMapper) TranslationMapPhysicalPageMapper*& _kernelPageMapper)
{ {
_pageMapper = new(&sPhysicalPageMapper) LargeMemoryPhysicalPageMapper; new(&sPhysicalPageMapper) LargeMemoryPhysicalPageMapper;
sPhysicalPageMapper.Init(args, _kernelPageMapper); sPhysicalPageMapper.Init(args, _kernelPageMapper);
_pageMapper = &sPhysicalPageMapper;
return B_OK; return B_OK;
} }