status_t X86PagingMethod32Bit::Init(kernel_args* args, VMPhysicalPageMapper** _physicalPageMapper) { TRACE("X86PagingMethod32Bit::Init(): entry\n"); // page hole set up in stage2 fPageHole = (page_table_entry*)(addr_t)args->arch_args.page_hole; // calculate where the pgdir would be fPageHolePageDir = (page_directory_entry*) (((addr_t)args->arch_args.page_hole) + (B_PAGE_SIZE * 1024 - B_PAGE_SIZE)); // clear out the bottom 2 GB, unmap everything memset(fPageHolePageDir + FIRST_USER_PGDIR_ENT, 0, sizeof(page_directory_entry) * NUM_USER_PGDIR_ENTS); fKernelPhysicalPageDirectory = args->arch_args.phys_pgdir; fKernelVirtualPageDirectory = (page_directory_entry*)(addr_t) args->arch_args.vir_pgdir; #ifdef TRACE_X86_PAGING_METHOD_32_BIT TRACE("page hole: %p, page dir: %p\n", fPageHole, fPageHolePageDir); TRACE("page dir: %p (physical: %#" B_PRIx32 ")\n", fKernelVirtualPageDirectory, fKernelPhysicalPageDirectory); #endif X86PagingStructures32Bit::StaticInit(); // create the initial pool for the physical page mapper PhysicalPageSlotPool* pool = new(&PhysicalPageSlotPool::sInitialPhysicalPagePool) PhysicalPageSlotPool; status_t error = pool->InitInitial(args); if (error != B_OK) { panic("X86PagingMethod32Bit::Init(): Failed to create initial pool " "for physical page mapper!"); return error; } // create physical page mapper large_memory_physical_page_ops_init(args, pool, fPhysicalPageMapper, fKernelPhysicalPageMapper); // TODO: Select the best page mapper! // enable global page feature if available if (x86_check_feature(IA32_FEATURE_PGE, FEATURE_COMMON)) { // this prevents kernel pages from being flushed from TLB on // context-switch x86_write_cr4(x86_read_cr4() | IA32_CR4_GLOBAL_PAGES); } TRACE("X86PagingMethod32Bit::Init(): done\n"); *_physicalPageMapper = fPhysicalPageMapper; return B_OK; }
status_t ARMPagingMethod32Bit::Init(kernel_args* args, VMPhysicalPageMapper** _physicalPageMapper) { TRACE("vm_translation_map_init: entry\n"); fKernelPhysicalPageDirectory = args->arch_args.phys_pgdir; fKernelVirtualPageDirectory = (page_directory_entry*) args->arch_args.vir_pgdir; TRACE("page dir: %p (physical: %#" B_PRIx32 ")\n", fKernelVirtualPageDirectory, fKernelPhysicalPageDirectory); ARMPagingStructures32Bit::StaticInit(); // create the initial pool for the physical page mapper PhysicalPageSlotPool* pool = new(&PhysicalPageSlotPool::sInitialPhysicalPagePool) PhysicalPageSlotPool; status_t error = pool->InitInitial(args); if (error != B_OK) { panic("ARMPagingMethod32Bit::Init(): Failed to create initial pool " "for physical page mapper!"); return error; } // create physical page mapper large_memory_physical_page_ops_init(args, pool, fPhysicalPageMapper, fKernelPhysicalPageMapper); // TODO: Select the best page mapper! // enable global page feature if available #if 0 //IRA: check for ARMv6!! if (x86_check_feature(IA32_FEATURE_PGE, FEATURE_COMMON)) { // this prevents kernel pages from being flushed from TLB on // context-switch x86_write_cr4(x86_read_cr4() | IA32_CR4_GLOBAL_PAGES); } #endif TRACE("ARMPagingMethod32Bit::Init(): done\n"); *_physicalPageMapper = fPhysicalPageMapper; return B_OK; }