From: Paolo Bonzini <[email protected]> InitPaging() is setting a page directory entry before initializing the corresponding page table. This works on real hardware (including KVM), but the TLB of QEMU's emulation mode is different (possibly it has different associativity, I don't really know) so at some point execution goes to nowhere's land.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Paolo Bonzini <[email protected]> [[email protected]: converted patch to CRLF] Cc: Michael Kinney <[email protected]> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <[email protected]> --- Notes: v3: - New in v3, but included only for completeness here. This is a fixup from Paolo for Mike's series "[edk2] [PATCH 0/7] UefiCpuPkg: Add CPU SMM and SecCore". UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c index e6eacb5..f2281f5 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c @@ -555,12 +555,12 @@ InitPaging ( Pt = AllocatePages (1); ASSERT (Pt != NULL); - *Pte = (UINTN)Pt | IA32_PG_RW | IA32_PG_P; - // Split it - for (Level4 = 0; Level4 < SIZE_4KB / sizeof(*Pt); Level4++, Pt++) { - *Pt = Address + ((Level4 << 12) | IA32_PG_RW | IA32_PG_P); + for (Level4 = 0; Level4 < SIZE_4KB / sizeof(*Pt); Level4++) { + Pt[Level4] = Address + ((Level4 << 12) | IA32_PG_RW | IA32_PG_P); } // end for PT + + *Pte = (UINTN)Pt | IA32_PG_RW | IA32_PG_P; } // end if IsAddressSplit } // end for PTE } // end for PDE -- 1.8.3.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

