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;
|
40 | 40 | extern "C" uint8 _end; |
41 | 41 | |
42 | 42 | |
43 | | #if 0 |
44 | 43 | static status_t |
45 | 44 | insert_virtual_range_to_keep(void *start, uint32 size) |
46 | 45 | { |
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); |
50 | 49 | } |
51 | | #endif |
52 | 50 | |
53 | 51 | |
54 | 52 | static status_t |
… |
… |
find_allocated_ranges(void *oldPageTable, void *pageTable,
|
302 | 300 | // cannot preserve, since that doesn't lie in the kernel address space. Mappings |
303 | 301 | // >= 2 GB are probably memory mapped hardware registers or the frame buffer |
304 | 302 | // (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 | |
306 | 310 | if (keepRange) { |
307 | 311 | if (insert_virtual_range_to_keep(map->virtual_address, |
308 | 312 | map->length) != B_OK) { |
… |
… |
find_allocated_ranges(void *oldPageTable, void *pageTable,
|
310 | 314 | gKernelArgs.num_virtual_allocated_ranges); |
311 | 315 | } |
312 | 316 | } |
313 | | #endif |
314 | 317 | |
315 | 318 | total += map->length; |
316 | 319 | } |
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)
|
140 | 140 | args.arguments = NULL; |
141 | 141 | |
142 | 142 | of_init(openFirmwareEntry); |
| 143 | gKernelArgs.platform_args.openfirmware_entry = openFirmwareEntry; |
143 | 144 | |
144 | 145 | // check for arguments |
145 | 146 | if (of_getprop(gChosen, "bootargs", bootargs, sizeof(bootargs)) != OF_FAILED) { |
… |
… |
start(void *openFirmwareEntry)
|
162 | 163 | if (init_real_time_clock() != B_OK) |
163 | 164 | of_exit(); |
164 | 165 | |
165 | | gKernelArgs.platform_args.openfirmware_entry = openFirmwareEntry; |
166 | | |
167 | 166 | main(&args); |
168 | 167 | // if everything goes fine, main() never returns |
169 | 168 | |