From ea5b67a88bb7d6a2c832381ae3424e0018346452 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 28 Dec 2005 19:54:19 +0000 Subject: [PATCH] Don't allocate the heap with of_claim(), but rather use platform_allocation_region(). Since the callback stuff doesn't seem to work, the Open Firmware didn't ask us to allocate memory in turn, and thus we didn't know about the range that had been mapped and reused it later. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15699 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../boot/platform/openfirmware/heap.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/system/boot/platform/openfirmware/heap.cpp b/src/system/boot/platform/openfirmware/heap.cpp index 1ee8f6b791..0a46cd76eb 100644 --- a/src/system/boot/platform/openfirmware/heap.cpp +++ b/src/system/boot/platform/openfirmware/heap.cpp @@ -3,6 +3,7 @@ * Distributed under the terms of the MIT License. */ +#include #include #include @@ -23,18 +24,12 @@ platform_init_heap(stage2_args *args, void **_base, void **_top) { TRACE(("platform_init_heap()\n")); - int memory; - if (of_getprop(gChosen, "memory", &memory, sizeof(int)) == OF_FAILED) - return B_ERROR; + *_base = NULL; + status_t error = platform_allocate_region(_base, args->heap_size, + B_READ_AREA | B_WRITE_AREA); + if (error != B_OK) + return error; - printf("memory = %d\n", memory); - struct of_region available; - int memPackage = of_instance_to_package(memory); - printf("memPackage = %d\n", memPackage); - of_getprop(memPackage, "available", &available, sizeof(struct of_region)); - printf("available: base = %p, size = %ld\n", available.base, available.size); - - *_base = of_claim(available.base, args->heap_size, 64); printf("heap base = %p\n", *_base); *_top = (void *)((int8 *)*_base + args->heap_size); printf("heap top = %p\n", *_top); @@ -47,6 +42,6 @@ void platform_release_heap(stage2_args *args, void *base) { if (base != NULL) - of_release(base, args->heap_size); + platform_free_region(base, args->heap_size); }