diff --git a/reactos/boot/freeldr/freeldr/arch/arm/macharm.c b/reactos/boot/freeldr/freeldr/arch/arm/macharm.c index 49a38b042c8..6df6dbdf62b 100644 --- a/reactos/boot/freeldr/freeldr/arch/arm/macharm.c +++ b/reactos/boot/freeldr/freeldr/arch/arm/macharm.c @@ -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); diff --git a/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c b/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c index d61240dd682..0245dfc3b8a 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c @@ -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 diff --git a/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c b/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c index 93624fd3081..53900d6ed94 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c @@ -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; diff --git a/reactos/boot/freeldr/freeldr/arch/i386/xboxmem.c b/reactos/boot/freeldr/freeldr/arch/i386/xboxmem.c index 0ffea08e396..b06c80d770f 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/xboxmem.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/xboxmem.c @@ -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 */ diff --git a/reactos/boot/freeldr/freeldr/include/arcemul.h b/reactos/boot/freeldr/freeldr/include/arcemul.h index 2d6a450d2ca..931ef5c215e 100644 --- a/reactos/boot/freeldr/freeldr/include/arcemul.h +++ b/reactos/boot/freeldr/freeldr/include/arcemul.h @@ -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); diff --git a/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h b/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h index 2daa37d6743..8ce967d45a5 100644 --- a/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h +++ b/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h @@ -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); diff --git a/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h b/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h index 9fb6914d915..9fc3966f977 100644 --- a/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h +++ b/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h @@ -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); diff --git a/reactos/boot/freeldr/freeldr/include/machine.h b/reactos/boot/freeldr/freeldr/include/machine.h index ce083f7cb52..9c3bfdc6b58 100644 --- a/reactos/boot/freeldr/freeldr/include/machine.h +++ b/reactos/boot/freeldr/freeldr/include/machine.h @@ -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); diff --git a/reactos/boot/freeldr/freeldr/include/mm.h b/reactos/boot/freeldr/freeldr/include/mm.h index f4d20b69076..2c721b91f2f 100644 --- a/reactos/boot/freeldr/freeldr/include/mm.h +++ b/reactos/boot/freeldr/freeldr/include/mm.h @@ -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 typedef struct { diff --git a/reactos/boot/freeldr/freeldr/mm/meminit.c b/reactos/boot/freeldr/freeldr/mm/meminit.c index a0206b2c113..ef361d28cd9 100644 --- a/reactos/boot/freeldr/freeldr/mm/meminit.c +++ b/reactos/boot/freeldr/freeldr/mm/meminit.c @@ -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;