Skip to content

Commit e1853c6

Browse files
[FREELDR:UEFI] Correctly pass through ACPI information and map its memory (reactos#8669)
This prevents bugchecks in Windows due to the ACPI table being overwritten because of the incorrect UEFI to E820 memory mappings. CORE-11954
1 parent 06ae7ec commit e1853c6

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

boot/freeldr/freeldr/arch/uefi/uefihw.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ DBG_DEFAULT_CHANNEL(WARNING);
1818
extern EFI_SYSTEM_TABLE * GlobalSystemTable;
1919
extern EFI_HANDLE GlobalImageHandle;
2020
extern UCHAR PcBiosDiskCount;
21-
extern EFI_MEMORY_DESCRIPTOR* EfiMemoryMap;
22-
extern UINT32 FreeldrDescCount;
2321

2422
/* From uefivid.c */
2523
extern ULONG_PTR VramAddress;
@@ -74,8 +72,7 @@ DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
7472
AcpiPresent = TRUE;
7573

7674
/* Calculate the table size */
77-
TableSize = FreeldrDescCount * sizeof(BIOS_MEMORY_MAP) +
78-
sizeof(ACPI_BIOS_DATA) - sizeof(BIOS_MEMORY_MAP);
75+
TableSize = sizeof(ACPI_BIOS_DATA);
7976

8077
/* Set 'Configuration Data' value */
8178
Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[1]) + TableSize;
@@ -110,9 +107,7 @@ DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
110107
AcpiBiosData->RSDTAddress.LowPart = Rsdp->rsdt_physical_address;
111108
}
112109

113-
AcpiBiosData->Count = FreeldrDescCount;
114-
RtlCopyMemory(AcpiBiosData->MemoryMap, EfiMemoryMap,
115-
FreeldrDescCount * sizeof(BIOS_MEMORY_MAP));
110+
AcpiBiosData->Count = 0;
116111

117112
TRACE("RSDT %p, data size %x\n", Rsdp->rsdt_physical_address, TableSize);
118113

boot/freeldr/freeldr/arch/uefi/uefimem.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ UefiConvertToFreeldrDesc(EFI_MEMORY_TYPE EfiMemoryType)
127127
case EfiUnusableMemory:
128128
return LoaderBad;
129129
case EfiACPIReclaimMemory:
130-
return LoaderFirmwareTemporary;
130+
return LoaderSpecialMemory;
131131
case EfiACPIMemoryNVS:
132-
return LoaderReserve;
132+
return LoaderSpecialMemory;
133133
case EfiMemoryMappedIO:
134134
return LoaderReserve;
135135
case EfiMemoryMappedIOPortSpace:

0 commit comments

Comments
 (0)