Ticket #5193: 0002-Map-ranges-to-keep-with-vm_map_physical_memory.patch

File 0002-Map-ranges-to-keep-with-vm_map_physical_memory.patch, 1.6 KB (added by andreasf, 10 years ago)

proposed patch: map physical memory to keep differently

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

    From 0ca6ba2e487fcea49b482fb3f17d34a91d71812c 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/5] Map ranges to keep with vm_map_physical_memory
    
    create_area() assumes a RAM-backed address.
    ---
     src/system/kernel/arch/ppc/arch_vm.cpp |   13 ++++++++++---
     1 files changed, 10 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..a3e97ef 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 = vm_map_physical_memory(VMAddressSpace::KernelID(),
     127            "boot loader reserved area", &address,
     128            B_EXACT_ADDRESS, range.size,
     129            B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA,
     130            physicalAddress, true);
    124131        if (area < 0) {
    125132            panic("arch_vm_init_end(): Failed to create area for boot loader "
    126133                "reserved area: %p - %p\n", (void*)range.start,