On Wed, Jan 18, 2023 at 09:12:09AM +0000, Zhiguang Liu wrote:
> Hi Gerd,
> 
> Let's check the code in InitPaging.
> If 5LevelPaging is disabled, Pml5 points to a local variable. Pml5[1] 
> shouldn't be used.
> 
>      UINT64    Pml5Entry;
>      UINT64    *Pml5;
>      if (!Enable5LevelPaging) {
>         Pml5Entry = (UINTN)mSmmProfileCr3 | IA32_PG_P;
>         Pml5      = &Pml5Entry;

Oh, it's just a dummy entry on the stack, not an dummy page table.
Missed that detail.

So writing entry #2 and higher smashes the stack.  That certainly
explains why the code hangs.

> And for the CpuPageTableLib, I think the API don't provide the
> interface to split 2MB-page page table into 4KB-page, which is the
> function wants to do.

I think that is handled by the library automatically.  You can request
address ranges being mapped with specific attributes (such as NX set),
and the library will transparently split pages for you if needed.

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#98794): https://edk2.groups.io/g/devel/message/98794
Mute This Topic: https://groups.io/mt/96045489/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to