- Add a runtime switch between using freeldr-embedded configuration tree heap, or...
authorAleksey Bragin <aleksey@reactos.org>
Fri, 25 Jan 2008 15:08:27 +0000 (15:08 +0000)
committerAleksey Bragin <aleksey@reactos.org>
Fri, 25 Jan 2008 15:08:27 +0000 (15:08 +0000)
- Use that in winldr.

svn path=/trunk/; revision=31996

reactos/boot/freeldr/freeldr/reactos/archwsup.c
reactos/boot/freeldr/freeldr/windows/winldr.c

index e481d6a..75be54a 100644 (file)
@@ -18,6 +18,8 @@ extern CHAR reactos_arc_hardware_data[];
 ULONG FldrpHwHeapLocation;
 PCONFIGURATION_COMPONENT_DATA FldrArcHwTreeRoot;
 
+BOOLEAN UseRealHeap = FALSE;
+
 /* FUNCTIONS ******************************************************************/
 
 PVOID
@@ -25,13 +27,21 @@ NTAPI
 FldrpHwHeapAlloc(IN ULONG Size)
 {
     PVOID Buffer;
-    
-    /* Return a block of memory from the ARC Hardware Heap */
-    Buffer = &reactos_arc_hardware_data[FldrpHwHeapLocation];
-    
-    /* Increment the heap location */
-    FldrpHwHeapLocation += Size;
-    if (FldrpHwHeapLocation > HW_MAX_ARC_HEAP_SIZE) Buffer = NULL;
+
+    if (UseRealHeap)
+    {
+        /* Allocate memory from generic bootloader heap */
+        Buffer = MmHeapAlloc(Size);
+    }
+    else
+    {
+        /* Return a block of memory from the ARC Hardware Heap */
+        Buffer = &reactos_arc_hardware_data[FldrpHwHeapLocation];
+
+        /* Increment the heap location */
+        FldrpHwHeapLocation += Size;
+        if (FldrpHwHeapLocation > HW_MAX_ARC_HEAP_SIZE) Buffer = NULL;
+    }
 
     /* Clear it */
     if (Buffer)
index 2ce1cde..3b046c7 100644 (file)
@@ -29,6 +29,8 @@ extern ULONG reactos_disk_count;
 extern ARC_DISK_SIGNATURE reactos_arc_disk_info[];\r
 extern char reactos_arc_strings[32][256];\r
 \r
+extern BOOLEAN UseRealHeap;\r
+\r
 BOOLEAN\r
 WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,\r
                         IN PCH DllName,\r
@@ -429,6 +431,7 @@ LoadAndBootWindows(PCSTR OperatingSystemName, WORD OperatingSystemVersion)
        AllocateAndInitLPB(&LoaderBlock);\r
 \r
        /* Detect hardware */\r
+       UseRealHeap = TRUE;\r
        LoaderBlock->ConfigurationRoot = MachHwDetect();\r
 \r
        /* Load kernel */\r