Ticket #5193: 0001-Keep-OpenFirmware-memory-translation.patch

File 0001-Keep-OpenFirmware-memory-translation.patch, 2.8 KB (added by andreasf, 10 years ago)

proposed patch: explicitly keep the translation containing OpenFirmware

  • src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp

    From d9aa060d9a17f649943659c5e237437aea0c4c76 Mon Sep 17 00:00:00 2001
    From: Andreas Faerber <andreas.faerber@web.de>
    Date: Thu, 3 Jun 2010 23:34:32 +0200
    Subject: [PATCH 1/3] Keep OpenFirmware memory translation
    
    ---
     .../boot/platform/openfirmware/arch/ppc/mmu.cpp    |   17 ++++++++++-------
     src/system/boot/platform/openfirmware/start.c      |    3 +--
     2 files changed, 11 insertions(+), 9 deletions(-)
    
    diff --git a/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp b/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp
    index a5429ef..b83e0f6 100644
    a b extern "C" uint8 __text_begin;  
    4040extern "C" uint8 _end;
    4141
    4242
    43 #if 0
    4443static status_t
    4544insert_virtual_range_to_keep(void *start, uint32 size)
    4645{
    47     return insert_memory_range(gKernelArgs.arch_args.virtual_ranges_to_keep,
    48         gKernelArgs.arch_args.num_virtual_ranges_to_keep,
    49         MAX_VIRTUAL_RANGES_TO_KEEP, start, size);
     46    return insert_address_range(gKernelArgs.arch_args.virtual_ranges_to_keep,
     47        &gKernelArgs.arch_args.num_virtual_ranges_to_keep,
     48        MAX_VIRTUAL_RANGES_TO_KEEP, (addr_t)start, size);
    5049}
    51 #endif
    5250
    5351
    5452static status_t
    find_allocated_ranges(void *oldPageTable, void *pageTable,  
    302300// cannot preserve, since that doesn't lie in the kernel address space. Mappings
    303301// >= 2 GB are probably memory mapped hardware registers or the frame buffer
    304302// (i.e. non-RAM), which we don't handle correctly ATM.
    305 #if 0
     303        if ((addr_t)map->virtual_address
     304                <= (addr_t)gKernelArgs.platform_args.openfirmware_entry &&
     305            (addr_t)map->virtual_address + map->length
     306                > (addr_t)gKernelArgs.platform_args.openfirmware_entry) {
     307            puts("found OpenFirmware!");
     308        } else keepRange = false;
     309
    306310        if (keepRange) {
    307311            if (insert_virtual_range_to_keep(map->virtual_address,
    308312                    map->length) != B_OK) {
    find_allocated_ranges(void *oldPageTable, void *pageTable,  
    310314                    gKernelArgs.num_virtual_allocated_ranges);
    311315            }
    312316        }
    313 #endif
    314317
    315318        total += map->length;
    316319    }
  • src/system/boot/platform/openfirmware/start.c

    diff --git a/src/system/boot/platform/openfirmware/start.c b/src/system/boot/platform/openfirmware/start.c
    index 7a8dc2e..3fc851d 100644
    a b start(void *openFirmwareEntry)  
    140140    args.arguments = NULL;
    141141
    142142    of_init(openFirmwareEntry);
     143    gKernelArgs.platform_args.openfirmware_entry = openFirmwareEntry;
    143144
    144145    // check for arguments
    145146    if (of_getprop(gChosen, "bootargs", bootargs, sizeof(bootargs)) != OF_FAILED) {
    start(void *openFirmwareEntry)  
    162163    if (init_real_time_clock() != B_OK)
    163164        of_exit();
    164165
    165     gKernelArgs.platform_args.openfirmware_entry = openFirmwareEntry;
    166 
    167166    main(&args);
    168167        // if everything goes fine, main() never returns
    169168