Author: dgorbachev Date: Sat Sep 24 17:25:29 2011 New Revision: 53841
URL: http://svn.reactos.org/svn/reactos?rev=53841&view=rev Log: [FREELDR] Add FREELDR_MEMORY_DESCRIPTOR structure using TYPE_OF_MEMORY instead of MEMORY_TYPE. Use it in place of MEMORY_DESCRIPTOR. Undo r53837 changes.
Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c trunk/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxmem.c trunk/reactos/boot/freeldr/freeldr/include/arcemul.h trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h trunk/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h trunk/reactos/boot/freeldr/freeldr/include/machine.h trunk/reactos/boot/freeldr/freeldr/include/mm.h trunk/reactos/boot/freeldr/freeldr/mm/meminit.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/a... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c [iso-8859-1] Sat Sep 24 17:25:29 2011 @@ -143,9 +143,9 @@ return RootNode; }
-MEMORY_DESCRIPTOR ArmMemoryMap[32]; - -PMEMORY_DESCRIPTOR +FREELDR_MEMORY_DESCRIPTOR ArmMemoryMap[32]; + +PFREELDR_MEMORY_DESCRIPTOR ArmMemGetMemoryMap(OUT ULONG *MemoryMapSize) { ASSERT(ArmBoardBlock->MemoryMapEntryCount <= 32);
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c [iso-8859-1] Sat Sep 24 17:25:29 2011 @@ -271,6 +271,7 @@
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 @@ // 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)) - { - TRACE("Using Int 13 Extensions for read. DiskInt13ExtensionsSupported(%d) = %s\n", DriveNumber, DiskInt13ExtensionsSupported(DriveNumber) ? "TRUE" : "FALSE"); + ExtensionsSupported = DiskInt13ExtensionsSupported(DriveNumber); + + if ((DriveNumber >= 0x80) && ExtensionsSupported) + { + TRACE("Using Int 13 Extensions for read. DiskInt13ExtensionsSupported(%d) = %s\n", DriveNumber, ExtensionsSupported ? "TRUE" : "FALSE");
// // LBA is easy, nothing to calculate
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c [iso-8859-1] Sat Sep 24 17:25:29 2011 @@ -44,7 +44,7 @@ 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 @@
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 @@
static ULONG -PcMemGetBiosMemoryMap(PMEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSize) +PcMemGetBiosMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSize) { REGS Regs; ULONG MapCount = 0; @@ -292,7 +292,7 @@ }
-PMEMORY_DESCRIPTOR +PFREELDR_MEMORY_DESCRIPTOR PcMemGetMemoryMap(ULONG *MemoryMapSize) { ULONG i, EntryCount;
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxmem.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxmem.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxmem.c [iso-8859-1] Sat Sep 24 17:25:29 2011 @@ -75,9 +75,9 @@ AvailableMemoryMb = InstalledMemoryMb; }
-MEMORY_DESCRIPTOR BiosMemoryMap[2]; +FREELDR_MEMORY_DESCRIPTOR BiosMemoryMap[2];
-PMEMORY_DESCRIPTOR +PFREELDR_MEMORY_DESCRIPTOR XboxMemGetMemoryMap(ULONG *MemoryMapSize) { /* Synthesize memory map */
Modified: trunk/reactos/boot/freeldr/freeldr/include/arcemul.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arcemul.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arcemul.h [iso-8859-1] Sat Sep 24 17:25:29 2011 @@ -34,10 +34,6 @@ VOID* ConfigurationData, CONFIGURATION_COMPONENT* Component);
-/* mm.c */ -const MEMORY_DESCRIPTOR* -ArcGetMemoryDescriptor(const MEMORY_DESCRIPTOR* Current); - /* time.c */ TIMEINFO* ArcGetTime(VOID); ULONG ArcGetRelativeTime(VOID);
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h [iso-8859-1] Sat Sep 24 17:25:29 2011 @@ -49,7 +49,7 @@
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);
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h [iso-8859-1] Sat Sep 24 17:25:29 2011 @@ -46,7 +46,7 @@ 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);
Modified: trunk/reactos/boot/freeldr/freeldr/include/machine.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/machine.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/machine.h [iso-8859-1] Sat Sep 24 17:25:29 2011 @@ -57,8 +57,8 @@ 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);
Modified: trunk/reactos/boot/freeldr/freeldr/include/mm.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/mm.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/mm.h [iso-8859-1] Sat Sep 24 17:25:29 2011 @@ -26,6 +26,13 @@ BiosMemoryAcpiReclaim, 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
Modified: trunk/reactos/boot/freeldr/freeldr/mm/meminit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/mm/mem... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/mm/meminit.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/mm/meminit.c [iso-8859-1] Sat Sep 24 17:25:29 2011 @@ -59,7 +59,7 @@ ULONG MmLowestPhysicalPage = 0xFFFFFFFF; ULONG MmHighestPhysicalPage = 0;
-PMEMORY_DESCRIPTOR BiosMemoryMap; +PFREELDR_MEMORY_DESCRIPTOR BiosMemoryMap; ULONG BiosMemoryMapEntryCount;
extern ULONG_PTR MmHeapPointer; @@ -67,11 +67,11 @@
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 @@ 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 @@ 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 MmGetAddressablePageCountIncludingHoles(VOID) { - const MEMORY_DESCRIPTOR* MemoryDescriptor = NULL; + const FREELDR_MEMORY_DESCRIPTOR* MemoryDescriptor = NULL; ULONG PageCount;
// @@ -255,7 +255,7 @@ // // 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 @@
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 @@ 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 @@
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;