summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/Workspace/MetaFileParser.py
diff options
context:
space:
mode:
authorDongyan Qian <qiandongyan@loongson.cn>2026-06-09 14:41:36 +0300
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2026-06-10 11:13:27 +0300
commit48fa937f46db100cbb9667bce1d522dc178a192b (patch)
treee02b5211ddc24e321a8778e43c7aed9e5e3e04bf /BaseTools/Source/Python/Workspace/MetaFileParser.py
parent22831880dc5d17c434c25ce141f7b912add7f37a (diff)
downloadedk2-48fa937f46db100cbb9667bce1d522dc178a192b.tar.xz
OvmfPkg/LoongArchVirt: Fix ACPI table walk in reset library
The DXE ACPI GED reset library locates the FADT by walking the RSDT and XSDT from the RSDP. The existing code assumed that both RSDP address fields were non-zero and that every table entry was a valid ACPI table address. That assumption is unsafe once NULL pointer detection is enabled. A zero RSDT/XSDT address, or a zero table entry, can be converted into a pointer to address 0 and then dereferenced while checking the table signature. RSDT entries are 32-bit physical addresses, while XSDT entries are 64-bit physical addresses. Parse those entry arrays separately so the XSDT path does not split each 64-bit entry into two bogus 32-bit values. Use ReadUnaligned64() for XSDT entries because the ACPI table header size does not guarantee natural 8-byte alignment for the entry array on all architectures. Update the FADT discovery path to: - skip RSDT scanning when RsdtAddress is zero, - skip XSDT scanning when XsdtAddress is zero, - ignore zero RSDT/XSDT entries, - parse XSDT entries as UINT64 addresses, and - read XSDT entries with unaligned-safe access. This prevents the reset library from dereferencing address 0 while preserving the existing behavior of using the first FADT found through RSDT or XSDT. Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
Diffstat (limited to 'BaseTools/Source/Python/Workspace/MetaFileParser.py')
0 files changed, 0 insertions, 0 deletions