[FREELDR]
authorDmitry Gorbachev <gorbachev@reactos.org>
Sat, 24 Sep 2011 17:25:29 +0000 (17:25 +0000)
committerDmitry Gorbachev <gorbachev@reactos.org>
Sat, 24 Sep 2011 17:25:29 +0000 (17:25 +0000)
Add FREELDR_MEMORY_DESCRIPTOR structure using TYPE_OF_MEMORY instead of
MEMORY_TYPE. Use it in place of MEMORY_DESCRIPTOR. Undo r53837 changes.

svn path=/trunk/; revision=53841

reactos/boot/freeldr/freeldr/arch/arm/macharm.c
reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c
reactos/boot/freeldr/freeldr/arch/i386/pcmem.c
reactos/boot/freeldr/freeldr/arch/i386/xboxmem.c
reactos/boot/freeldr/freeldr/include/arcemul.h
reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h
reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h
reactos/boot/freeldr/freeldr/include/machine.h
reactos/boot/freeldr/freeldr/include/mm.h
reactos/boot/freeldr/freeldr/mm/meminit.c

index 49a38b0..6df6dbd 100644 (file)
@@ -143,9 +143,9 @@ ArmHwDetect(VOID)
     return RootNode;
 }
 
-MEMORY_DESCRIPTOR ArmMemoryMap[32];
+FREELDR_MEMORY_DESCRIPTOR ArmMemoryMap[32];
 
-PMEMORY_DESCRIPTOR
+PFREELDR_MEMORY_DESCRIPTOR
 ArmMemGetMemoryMap(OUT ULONG *MemoryMapSize)
 {
     ASSERT(ArmBoardBlock->MemoryMapEntryCount <= 32);
index d61240d..0245dfc 100644 (file)
@@ -271,6 +271,7 @@ static BOOLEAN PcDiskReadLogicalSectorsCHS(UCHAR DriveNumber, ULONGLONG SectorNu
 
 BOOLEAN PcDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
 {
+       BOOLEAN ExtensionsSupported;
 
        TRACE("PcDiskReadLogicalSectors() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer);
 
@@ -279,9 +280,11 @@ BOOLEAN PcDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULON
        // If so then check to see if Int13 extensions work
        // If they do then use them, otherwise default back to BIOS calls
        //
-       if ((DriveNumber >= 0x80) && DiskInt13ExtensionsSupported(DriveNumber))
+       ExtensionsSupported = DiskInt13ExtensionsSupported(DriveNumber);
+
+       if ((DriveNumber >= 0x80) && ExtensionsSupported)
        {
-               TRACE("Using Int 13 Extensions for read. DiskInt13ExtensionsSupported(%d) = %s\n", DriveNumber, DiskInt13ExtensionsSupported(DriveNumber) ? "TRUE" : "FALSE");
+               TRACE("Using Int 13 Extensions for read. DiskInt13ExtensionsSupported(%d) = %s\n", DriveNumber, ExtensionsSupported ? "TRUE" : "FALSE");
 
                //
                // LBA is easy, nothing to calculate
index 93624fd..53900d6 100644 (file)
@@ -44,7 +44,7 @@ DBG_DEFAULT_CHANNEL(MEMORY);
 BIOS_MEMORY_MAP PcBiosMemoryMap[MAX_BIOS_DESCRIPTORS];
 ULONG PcBiosMapCount;
 
-MEMORY_DESCRIPTOR PcMemoryMap[MAX_BIOS_DESCRIPTORS + 1] =
+FREELDR_MEMORY_DESCRIPTOR PcMemoryMap[MAX_BIOS_DESCRIPTORS + 1] =
 {
  { LoaderFirmwarePermanent, 0x00,               1 }, // realmode int vectors
  { LoaderFirmwareTemporary, 0x01,               FREELDR_BASE_PAGE - 1 }, // freeldr stack + cmdline
@@ -60,7 +60,7 @@ MEMORY_DESCRIPTOR PcMemoryMap[MAX_BIOS_DESCRIPTORS + 1] =
 
 ULONG
 AddMemoryDescriptor(
-    IN OUT PMEMORY_DESCRIPTOR List,
+    IN OUT PFREELDR_MEMORY_DESCRIPTOR List,
     IN ULONG MaxCount,
     IN PFN_NUMBER BasePage,
     IN PFN_NUMBER PageCount,
@@ -189,7 +189,7 @@ PcMemGetConventionalMemorySize(VOID)
 
 static
 ULONG
-PcMemGetBiosMemoryMap(PMEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSize)
+PcMemGetBiosMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSize)
 {
   REGS Regs;
   ULONG MapCount = 0;
@@ -292,7 +292,7 @@ PcMemGetBiosMemoryMap(PMEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSize)
 }
 
 
-PMEMORY_DESCRIPTOR
+PFREELDR_MEMORY_DESCRIPTOR
 PcMemGetMemoryMap(ULONG *MemoryMapSize)
 {
   ULONG i, EntryCount;
index 0ffea08..b06c80d 100644 (file)
@@ -75,9 +75,9 @@ XboxMemInit(VOID)
   AvailableMemoryMb = InstalledMemoryMb;
 }
 
-MEMORY_DESCRIPTOR BiosMemoryMap[2];
+FREELDR_MEMORY_DESCRIPTOR BiosMemoryMap[2];
 
-PMEMORY_DESCRIPTOR
+PFREELDR_MEMORY_DESCRIPTOR
 XboxMemGetMemoryMap(ULONG *MemoryMapSize)
 {
   /* Synthesize memory map */
index 2d6a450..931ef5c 100644 (file)
@@ -34,10 +34,6 @@ ArcGetConfigurationData(
     VOID* ConfigurationData,
     CONFIGURATION_COMPONENT* Component);
 
-/* mm.c */
-const MEMORY_DESCRIPTOR*
-ArcGetMemoryDescriptor(const MEMORY_DESCRIPTOR* Current);
-
 /* time.c */
 TIMEINFO* ArcGetTime(VOID);
 ULONG ArcGetRelativeTime(VOID);
index 2daa37d..8ce967d 100644 (file)
@@ -49,7 +49,7 @@ VOID XboxPrepareForReactOS(IN BOOLEAN Setup);
 
 VOID XboxMemInit(VOID);
 PVOID XboxMemReserveMemory(ULONG MbToReserve);
-PMEMORY_DESCRIPTOR XboxMemGetMemoryMap(ULONG *MemoryMapSize);
+PFREELDR_MEMORY_DESCRIPTOR XboxMemGetMemoryMap(ULONG *MemoryMapSize);
 
 BOOLEAN XboxDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
 BOOLEAN XboxDiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
index 9fb6914..9fc3966 100644 (file)
@@ -46,7 +46,7 @@ VOID PcVideoSync(VOID);
 VOID PcVideoPrepareForReactOS(IN BOOLEAN Setup);
 VOID PcPrepareForReactOS(IN BOOLEAN Setup);
 
-PMEMORY_DESCRIPTOR PcMemGetMemoryMap(ULONG *MemoryMapSize);
+PFREELDR_MEMORY_DESCRIPTOR PcMemGetMemoryMap(ULONG *MemoryMapSize);
 
 BOOLEAN PcDiskGetBootPath(char *BootPath, unsigned Size);
 BOOLEAN PcDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
index ce083f7..9c3bfdc 100644 (file)
@@ -57,8 +57,8 @@ typedef struct tagMACHVTBL
   VOID (*Beep)(VOID);
   VOID (*PrepareForReactOS)(IN BOOLEAN Setup);
 
-  MEMORY_DESCRIPTOR* (*GetMemoryDescriptor)(MEMORY_DESCRIPTOR* Current);
-  PMEMORY_DESCRIPTOR (*GetMemoryMap)(PULONG MaxMemoryMapSize);
+  FREELDR_MEMORY_DESCRIPTOR* (*GetMemoryDescriptor)(FREELDR_MEMORY_DESCRIPTOR* Current);
+  PFREELDR_MEMORY_DESCRIPTOR (*GetMemoryMap)(PULONG MaxMemoryMapSize);
 
   BOOLEAN (*DiskGetBootPath)(char *BootPath, unsigned Size);
   BOOLEAN (*DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
index f4d20b6..2c721b9 100644 (file)
@@ -27,6 +27,13 @@ typedef enum
        BiosMemoryAcpiNvs
 } BIOS_MEMORY_TYPE;
 
+typedef struct _FREELDR_MEMORY_DESCRIPTOR
+{
+    TYPE_OF_MEMORY MemoryType;
+    PFN_NUMBER BasePage;
+    PFN_NUMBER PageCount;
+} FREELDR_MEMORY_DESCRIPTOR, *PFREELDR_MEMORY_DESCRIPTOR;
+
 #include <pshpack1.h>
 typedef struct
 {
index a0206b2..ef361d2 100644 (file)
@@ -59,7 +59,7 @@ ULONG         LastFreePageHint = 0;
 ULONG MmLowestPhysicalPage = 0xFFFFFFFF;
 ULONG MmHighestPhysicalPage = 0;
 
-PMEMORY_DESCRIPTOR BiosMemoryMap;
+PFREELDR_MEMORY_DESCRIPTOR BiosMemoryMap;
 ULONG BiosMemoryMapEntryCount;
 
 extern ULONG_PTR       MmHeapPointer;
@@ -67,11 +67,11 @@ extern ULONG_PTR    MmHeapStart;
 
 ULONG
 AddMemoryDescriptor(
-    IN OUT PMEMORY_DESCRIPTOR List,
+    IN OUT PFREELDR_MEMORY_DESCRIPTOR List,
     IN ULONG MaxCount,
     IN PFN_NUMBER BasePage,
     IN PFN_NUMBER PageCount,
-    IN MEMORY_TYPE MemoryType)
+    IN TYPE_OF_MEMORY MemoryType)
 {
     ULONG i, c;
     PFN_NUMBER NextBase;
@@ -147,8 +147,8 @@ AddMemoryDescriptor(
     return c;
 }
 
-const MEMORY_DESCRIPTOR*
-ArcGetMemoryDescriptor(const MEMORY_DESCRIPTOR* Current)
+const FREELDR_MEMORY_DESCRIPTOR*
+ArcGetMemoryDescriptor(const FREELDR_MEMORY_DESCRIPTOR* Current)
 {
     if (Current == NULL)
     {
@@ -166,7 +166,7 @@ ArcGetMemoryDescriptor(const MEMORY_DESCRIPTOR* Current)
 BOOLEAN MmInitializeMemoryManager(VOID)
 {
 #if DBG
-       const MEMORY_DESCRIPTOR* MemoryDescriptor = NULL;
+       const FREELDR_MEMORY_DESCRIPTOR* MemoryDescriptor = NULL;
 #endif
 
        TRACE("Initializing Memory Manager.\n");
@@ -239,7 +239,7 @@ ULONG MmGetPageNumberFromAddress(PVOID Address)
 
 ULONG MmGetAddressablePageCountIncludingHoles(VOID)
 {
-    const MEMORY_DESCRIPTOR* MemoryDescriptor = NULL;
+    const FREELDR_MEMORY_DESCRIPTOR* MemoryDescriptor = NULL;
     ULONG PageCount;
 
     //
@@ -255,7 +255,7 @@ ULONG MmGetAddressablePageCountIncludingHoles(VOID)
             //
             // Yes, remember it if this is real memory
             //
-            if (MemoryDescriptor->MemoryType == MemoryFree)
+            if (MemoryDescriptor->MemoryType == LoaderFree)
                 MmHighestPhysicalPage = MemoryDescriptor->BasePage + MemoryDescriptor->PageCount;
         }
 
@@ -279,7 +279,7 @@ ULONG MmGetAddressablePageCountIncludingHoles(VOID)
 
 PVOID MmFindLocationForPageLookupTable(ULONG TotalPageCount)
 {
-    const MEMORY_DESCRIPTOR* MemoryDescriptor = NULL;
+    const FREELDR_MEMORY_DESCRIPTOR* MemoryDescriptor = NULL;
     ULONG PageLookupTableSize;
     ULONG PageLookupTablePages;
     ULONG PageLookupTableStartPage = 0;
@@ -293,7 +293,7 @@ PVOID MmFindLocationForPageLookupTable(ULONG TotalPageCount)
     while ((MemoryDescriptor = ArcGetMemoryDescriptor(MemoryDescriptor)) != NULL)
     {
         // Continue, if memory is not free
-        if (MemoryDescriptor->MemoryType != MemoryFree) continue;
+        if (MemoryDescriptor->MemoryType != LoaderFree) continue;
 
         // Continue, if the block is not big enough?
         if (MemoryDescriptor->PageCount < PageLookupTablePages) continue;
@@ -318,7 +318,7 @@ PVOID MmFindLocationForPageLookupTable(ULONG TotalPageCount)
 
 VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount)
 {
-    const MEMORY_DESCRIPTOR* MemoryDescriptor = NULL;
+    const FREELDR_MEMORY_DESCRIPTOR* MemoryDescriptor = NULL;
     TYPE_OF_MEMORY MemoryMapPageAllocated;
     ULONG PageLookupTableStartPage;
     ULONG PageLookupTablePageCount;