diff --git a/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp b/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp index a5429efed1..259d75c840 100644 --- a/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp +++ b/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp @@ -40,15 +40,13 @@ extern "C" uint8 __text_begin; extern "C" uint8 _end; -#if 0 static status_t insert_virtual_range_to_keep(void *start, uint32 size) { - return insert_memory_range(gKernelArgs.arch_args.virtual_ranges_to_keep, - gKernelArgs.arch_args.num_virtual_ranges_to_keep, - MAX_VIRTUAL_RANGES_TO_KEEP, start, size); + return insert_address_range(gKernelArgs.arch_args.virtual_ranges_to_keep, + &gKernelArgs.arch_args.num_virtual_ranges_to_keep, + MAX_VIRTUAL_RANGES_TO_KEEP, (addr_t)start, size); } -#endif static status_t @@ -297,12 +295,6 @@ find_allocated_ranges(void *oldPageTable, void *pageTable, // insert range in virtual ranges to keep -// TODO: ATM keeping the ranges doesn't make much sense. The OF usually identity -// maps stuff, which means that RAM will most likely be mapped < 2 GB, which we -// cannot preserve, since that doesn't lie in the kernel address space. Mappings -// >= 2 GB are probably memory mapped hardware registers or the frame buffer -// (i.e. non-RAM), which we don't handle correctly ATM. -#if 0 if (keepRange) { if (insert_virtual_range_to_keep(map->virtual_address, map->length) != B_OK) { @@ -310,7 +302,6 @@ find_allocated_ranges(void *oldPageTable, void *pageTable, gKernelArgs.num_virtual_allocated_ranges); } } -#endif total += map->length; } diff --git a/src/system/kernel/arch/ppc/arch_vm.cpp b/src/system/kernel/arch/ppc/arch_vm.cpp index 3d3f0043bb..a3e97ef8b5 100644 --- a/src/system/kernel/arch/ppc/arch_vm.cpp +++ b/src/system/kernel/arch/ppc/arch_vm.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -117,10 +118,16 @@ arch_vm_init_end(kernel_args *args) continue; } + phys_addr_t physicalAddress; void *address = (void*)range.start; - area_id area = create_area("boot loader reserved area", &address, - B_EXACT_ADDRESS, range.size, B_ALREADY_WIRED, - B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); + if (vm_get_page_mapping(VMAddressSpace::KernelID(), range.start, + &physicalAddress) != B_OK) + panic("arch_vm_init_end(): No page mapping for %p\n", address); + area_id area = vm_map_physical_memory(VMAddressSpace::KernelID(), + "boot loader reserved area", &address, + B_EXACT_ADDRESS, range.size, + B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, + physicalAddress, true); if (area < 0) { panic("arch_vm_init_end(): Failed to create area for boot loader " "reserved area: %p - %p\n", (void*)range.start,