From 4891bed4d2d8cfb590b688e6f39c3427f8a1c52b Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 27 Feb 2010 21:20:29 +0000 Subject: [PATCH] * 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 --- src/system/kernel/arch/x86/arch_vm_translation_map.cpp | 8 +++++--- .../arch/x86/x86_physical_page_mapper_large_memory.cpp | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/system/kernel/arch/x86/arch_vm_translation_map.cpp b/src/system/kernel/arch/x86/arch_vm_translation_map.cpp index ef0c10545e..64e4e4a46c 100644 --- a/src/system/kernel/arch/x86/arch_vm_translation_map.cpp +++ b/src/system/kernel/arch/x86/arch_vm_translation_map.cpp @@ -1446,7 +1446,7 @@ arch_vm_translation_map_is_kernel_page_accessible(addr_t virtualAddress, if (physicalPageDirectory == (addr_t)sKernelPhysicalPageDirectory) { pageDirectoryEntry = sKernelVirtualPageDirectory[index]; - } else { + } else if (sPhysicalPageMapper != NULL) { // map the original page directory and get the entry void* handle; addr_t virtualPageDirectory; @@ -1459,13 +1459,15 @@ arch_vm_translation_map_is_kernel_page_accessible(addr_t virtualAddress, handle); } else pageDirectoryEntry = 0; - } + } else + pageDirectoryEntry = 0; // map the page table and get the entry page_table_entry pageTableEntry; index = VADDR_TO_PTENT(virtualAddress); - if ((pageDirectoryEntry & X86_PDE_PRESENT) != 0) { + if ((pageDirectoryEntry & X86_PDE_PRESENT) != 0 + && sPhysicalPageMapper != NULL) { void* handle; addr_t virtualPageTable; status_t error = sPhysicalPageMapper->GetPageDebug( diff --git a/src/system/kernel/arch/x86/x86_physical_page_mapper_large_memory.cpp b/src/system/kernel/arch/x86/x86_physical_page_mapper_large_memory.cpp index e8ac2a0a8b..82ba13d47b 100644 --- a/src/system/kernel/arch/x86/x86_physical_page_mapper_large_memory.cpp +++ b/src/system/kernel/arch/x86/x86_physical_page_mapper_large_memory.cpp @@ -918,8 +918,9 @@ large_memory_physical_page_ops_init(kernel_args* args, X86PhysicalPageMapper*& _pageMapper, TranslationMapPhysicalPageMapper*& _kernelPageMapper) { - _pageMapper = new(&sPhysicalPageMapper) LargeMemoryPhysicalPageMapper; + new(&sPhysicalPageMapper) LargeMemoryPhysicalPageMapper; sPhysicalPageMapper.Init(args, _kernelPageMapper); + _pageMapper = &sPhysicalPageMapper; return B_OK; }