From 930b718aa73753c34eb943c6c6d83bab3f702d15 Mon Sep 17 00:00:00 2001 From: Art Yerkes Date: Mon, 3 Sep 2007 05:29:03 +0000 Subject: [PATCH] Move mismerged segment to the right place; claim from openfirmware if we don't have enough reserve. svn path=/trunk/; revision=28801 --- reactos/boot/freeldr/freeldr/mm/mm.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/mm/mm.c b/reactos/boot/freeldr/freeldr/mm/mm.c index 2d0371dec91..383493ff324 100644 --- a/reactos/boot/freeldr/freeldr/mm/mm.c +++ b/reactos/boot/freeldr/freeldr/mm/mm.c @@ -68,12 +68,6 @@ PVOID MmAllocateMemory(ULONG MemorySize) if (MemorySize == 0) { -#ifdef _M_PPC - ULONG ptr; - printf("Allocating %d bytes directly ...\n", MemorySize); - ptr = ofw_claim(0,MemorySize,MM_PAGE_SIZE); - MemPointer = (PVOID)(ptr); -#endif DbgPrint((DPRINT_MEMORY, "MmAllocateMemory() called for 0 bytes. Returning NULL.\n")); UiMessageBoxCritical("Memory allocation failed: MmAllocateMemory() called for 0 bytes."); return NULL; @@ -95,9 +89,17 @@ PVOID MmAllocateMemory(ULONG MemorySize) // then return NULL if (FreePagesInLookupTable < PagesNeeded) { +#ifdef _M_PPC + ULONG ptr; + printf("Allocating %d bytes directly ...\n", MemorySize); + ptr = ofw_claim(0,MemorySize,MM_PAGE_SIZE); + MemPointer = (PVOID)(ptr); + return MemPointer; +#else DbgPrint((DPRINT_MEMORY, "Memory allocation failed in MmAllocateMemory(). Not enough free memory to allocate %d bytes. AllocationCount: %d\n", MemorySize, AllocationCount)); UiMessageBoxCritical("Memory allocation failed: out of memory."); return NULL; +#endif } FirstFreePageFromEnd = MmFindAvailablePages(PageLookupTableAddress, TotalPagesInLookupTable, PagesNeeded, AllocateFromEnd);