Ticket #5193: 0002-Distinguish-between-RAM-and-non-RAM-ranges-to-keep.patch

File 0002-Distinguish-between-RAM-and-non-RAM-ranges-to-keep.patch, 1.8 KB (added by andreasf, 10 years ago)

proposed patch: distinguish between RAM and non-RAM ranges to keep

  • src/system/kernel/arch/ppc/arch_vm.cpp

    From de0c5d1fe9ba3337af81a251ca945044ce5759c1 Mon Sep 17 00:00:00 2001
    From: Andreas Faerber <andreas.faerber@web.de>
    Date: Sun, 6 Jun 2010 05:21:16 +0200
    Subject: [PATCH 2/3] Distinguish between RAM and non-RAM ranges to keep
    
    ---
     src/system/kernel/arch/ppc/arch_vm.cpp |   20 +++++++++++++++++---
     1 files changed, 17 insertions(+), 3 deletions(-)
    
    diff --git a/src/system/kernel/arch/ppc/arch_vm.cpp b/src/system/kernel/arch/ppc/arch_vm.cpp
    index 3d3f004..f3e6298 100644
    a b  
    1212#include <boot/kernel_args.h>
    1313
    1414#include <vm/vm.h>
     15#include <vm/VMAddressSpace.h>
    1516#include <arch/vm.h>
    1617#include <arch_mmu.h>
    1718
    arch_vm_init_end(kernel_args *args)  
    117118            continue;
    118119        }
    119120
     121        phys_addr_t physicalAddress;
    120122        void *address = (void*)range.start;
    121         area_id area = create_area("boot loader reserved area", &address,
    122             B_EXACT_ADDRESS, range.size, B_ALREADY_WIRED,
    123             B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
     123        if (vm_get_page_mapping(VMAddressSpace::KernelID(), range.start,
     124                &physicalAddress) != B_OK)
     125            panic("arch_vm_init_end(): No page mapping for %p\n", address);
     126        area_id area;
     127        if (physicalAddress < vm_available_memory()) {
     128            area = create_area("boot loader reserved area", &address,
     129                B_EXACT_ADDRESS, range.size, B_ALREADY_WIRED,
     130                B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
     131        } else {
     132            area = vm_map_physical_memory(VMAddressSpace::KernelID(),
     133                "boot loader reserved physical area", &address,
     134                B_EXACT_ADDRESS, range.size,
     135                B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA,
     136                physicalAddress, true);
     137        }
    124138        if (area < 0) {
    125139            panic("arch_vm_init_end(): Failed to create area for boot loader "
    126140                "reserved area: %p - %p\n", (void*)range.start,