Author: bonefish Date: 2010-06-05 00:23:22 +0200 (Sat, 05 Jun 2010) New Revision: 37011 Changeset: http://dev.haiku-os.org/changeset/37011/haiku Modified: haiku/trunk/headers/private/kernel/arch/x86/arch_thread.h haiku/trunk/headers/private/kernel/arch/x86/arch_vm_translation_map.h haiku/trunk/src/system/kernel/arch/x86/X86VMTranslationMap.h haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp haiku/trunk/src/system/kernel/arch/x86/arch_thread.cpp haiku/trunk/src/system/kernel/arch/x86/arch_vm_translation_map.cpp haiku/trunk/src/system/kernel/arch/x86/x86_paging.h Log: Consequently use uint32 for the physical page directory address. Modified: haiku/trunk/headers/private/kernel/arch/x86/arch_thread.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/x86/arch_thread.h 2010-06-04 22:04:20 UTC (rev 37010) +++ haiku/trunk/headers/private/kernel/arch/x86/arch_thread.h 2010-06-04 22:23:22 UTC (rev 37011) @@ -20,7 +20,7 @@ struct iframe *i386_get_current_iframe(void); struct iframe *i386_get_thread_user_iframe(struct thread *thread); -void *x86_next_page_directory(struct thread *from, struct thread *to); +uint32 x86_next_page_directory(struct thread *from, struct thread *to); void x86_restart_syscall(struct iframe* frame); Modified: haiku/trunk/headers/private/kernel/arch/x86/arch_vm_translation_map.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/x86/arch_vm_translation_map.h 2010-06-04 22:04:20 UTC (rev 37010) +++ haiku/trunk/headers/private/kernel/arch/x86/arch_vm_translation_map.h 2010-06-04 22:23:22 UTC (rev 37011) @@ -12,6 +12,6 @@ #ifdef __cplusplus extern "C" #endif -void *i386_translation_map_get_pgdir(VMTranslationMap *map); +uint32 i386_translation_map_get_pgdir(VMTranslationMap *map); #endif /* _KERNEL_ARCH_x86_VM_TRANSLATION_MAP_H */ Modified: haiku/trunk/src/system/kernel/arch/x86/X86VMTranslationMap.h =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/X86VMTranslationMap.h 2010-06-04 22:04:20 UTC (rev 37010) +++ haiku/trunk/src/system/kernel/arch/x86/X86VMTranslationMap.h 2010-06-04 22:23:22 UTC (rev 37011) @@ -17,7 +17,7 @@ inline vm_translation_map_arch_info* ArchData() const { return fArchData; } - inline void* PhysicalPageDir() const + inline uint32 PhysicalPageDir() const { return fArchData->pgdir_phys; } virtual status_t InitPostSem(); Modified: haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp 2010-06-04 22:04:20 UTC (rev 37010) +++ haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp 2010-06-04 22:23:22 UTC (rev 37011) @@ -394,7 +394,7 @@ if (id != thread_get_current_thread_id()) { // switch to the page directory of the new thread to be // able to follow the stack trace into userland - uint32 newPageDirectory = (uint32)x86_next_page_directory( + uint32 newPageDirectory = x86_next_page_directory( thread_get_current_thread(), thread); if (newPageDirectory != 0) { @@ -931,7 +931,7 @@ // switch the page directory, if necessary uint32 oldPageDirectory = 0; if (thread != thread_get_current_thread()) { - uint32 newPageDirectory = (uint32)x86_next_page_directory( + uint32 newPageDirectory = x86_next_page_directory( thread_get_current_thread(), thread); if (newPageDirectory != 0) { Modified: haiku/trunk/src/system/kernel/arch/x86/arch_thread.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_thread.cpp 2010-06-04 22:04:20 UTC (rev 37010) +++ haiku/trunk/src/system/kernel/arch/x86/arch_thread.cpp 2010-06-04 22:23:22 UTC (rev 37011) @@ -189,13 +189,13 @@ } -void * +uint32 x86_next_page_directory(struct thread *from, struct thread *to) { VMAddressSpace* toAddressSpace = to->team->address_space; if (from->team->address_space == toAddressSpace) { // don't change the pgdir, same address space - return NULL; + return 0; } if (toAddressSpace == NULL) @@ -389,7 +389,7 @@ cpuData->arch.active_translation_map = toMap; // get the new page directory - newPageDirectory = (uint32)toMap->pgdir_phys; + newPageDirectory = toMap->pgdir_phys; } else { newPageDirectory = 0; // this means no change Modified: haiku/trunk/src/system/kernel/arch/x86/arch_vm_translation_map.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_vm_translation_map.cpp 2010-06-04 22:04:20 UTC (rev 37010) +++ haiku/trunk/src/system/kernel/arch/x86/arch_vm_translation_map.cpp 2010-06-04 22:23:22 UTC (rev 37011) @@ -43,7 +43,7 @@ static page_table_entry *sPageHole = NULL; static page_directory_entry *sPageHolePageDir = NULL; -static page_directory_entry *sKernelPhysicalPageDirectory = NULL; +static uint32 sKernelPhysicalPageDirectory = 0; static page_directory_entry *sKernelVirtualPageDirectory = NULL; static X86PhysicalPageMapper* sPhysicalPageMapper; @@ -117,7 +117,7 @@ // overwriting an active page directory is suspected uint32 activePageDirectory; read_cr3(activePageDirectory); - if (activePageDirectory == (uint32)pgdir_phys) + if (activePageDirectory == pgdir_phys) panic("deleting a still active page directory\n"); #endif @@ -208,7 +208,7 @@ // #pragma mark - -void * +uint32 i386_translation_map_get_pgdir(VMTranslationMap* map) { return static_cast<X86VMTranslationMap*>(map)->PhysicalPageDir(); @@ -340,7 +340,7 @@ vm_get_page_mapping(VMAddressSpace::KernelID(), (addr_t)fArchData->pgdir_virt, &physicalPageDir); - fArchData->pgdir_phys = (page_directory_entry*)(addr_t)physicalPageDir; + fArchData->pgdir_phys = physicalPageDir; } else { // kernel // get the physical page mapper @@ -1346,15 +1346,14 @@ memset(sPageHolePageDir + FIRST_USER_PGDIR_ENT, 0, sizeof(page_directory_entry) * NUM_USER_PGDIR_ENTS); - sKernelPhysicalPageDirectory = (page_directory_entry*) - args->arch_args.phys_pgdir; + sKernelPhysicalPageDirectory = args->arch_args.phys_pgdir; sKernelVirtualPageDirectory = (page_directory_entry*) args->arch_args.vir_pgdir; #ifdef TRACE_VM_TMAP TRACE("page hole: %p, page dir: %p\n", sPageHole, sPageHolePageDir); - TRACE("page dir: %p (physical: %p)\n", sKernelVirtualPageDirectory, - sKernelPhysicalPageDirectory); + TRACE("page dir: %p (physical: %#" B_PRIx32 ")\n", + sKernelVirtualPageDirectory, sKernelPhysicalPageDirectory); TRACE("physical memory ranges:\n"); for (uint32 i = 0; i < args->num_physical_memory_ranges; i++) { @@ -1515,7 +1514,7 @@ page_directory_entry pageDirectoryEntry; uint32 index = VADDR_TO_PDENT(virtualAddress); - if (physicalPageDirectory == (uint32)sKernelPhysicalPageDirectory) { + if (physicalPageDirectory == sKernelPhysicalPageDirectory) { pageDirectoryEntry = sKernelVirtualPageDirectory[index]; } else if (sPhysicalPageMapper != NULL) { // map the original page directory and get the entry @@ -1553,7 +1552,7 @@ pageTableEntry = 0; // switch back to the original page directory - if (physicalPageDirectory != (uint32)sKernelPhysicalPageDirectory) + if (physicalPageDirectory != sKernelPhysicalPageDirectory) write_cr3(physicalPageDirectory); if ((pageTableEntry & X86_PTE_PRESENT) == 0) Modified: haiku/trunk/src/system/kernel/arch/x86/x86_paging.h =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/x86_paging.h 2010-06-04 22:04:20 UTC (rev 37010) +++ haiku/trunk/src/system/kernel/arch/x86/x86_paging.h 2010-06-04 22:23:22 UTC (rev 37011) @@ -65,7 +65,7 @@ struct vm_translation_map_arch_info : DeferredDeletable { page_directory_entry* pgdir_virt; - page_directory_entry* pgdir_phys; + uint32 pgdir_phys; TranslationMapPhysicalPageMapper* page_mapper; vint32 ref_count; vint32 active_on_cpus;