mirror of https://github.com/acidanthera/audk.git
1. Add the missing function headers.
2. Update local variable name to match coding style. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10355 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
a58cc068b6
commit
e9ba23c77d
|
@ -106,6 +106,10 @@ CPU_SAVE_STATE_CONVERSION mCpuSaveStateConvTable[] = {
|
||||||
{EFI_SMM_SAVE_STATE_REGISTER_CR3 , CPU_SAVE_STATE_GET_OFFSET(CR3)}
|
{EFI_SMM_SAVE_STATE_REGISTER_CR3 , CPU_SAVE_STATE_GET_OFFSET(CR3)}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Page fault handler.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
PageFaultHandlerHook (
|
PageFaultHandlerHook (
|
||||||
VOID
|
VOID
|
||||||
|
@ -391,9 +395,9 @@ InitCpuStatePageTable (
|
||||||
{
|
{
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
UINT64 *PageTable;
|
UINT64 *PageTable;
|
||||||
UINT64 *PDPTE;
|
UINT64 *Pdpte;
|
||||||
UINT64 HookAddress;
|
UINT64 HookAddress;
|
||||||
UINT64 PDE;
|
UINT64 Pde;
|
||||||
UINT64 Address;
|
UINT64 Address;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -409,21 +413,21 @@ InitCpuStatePageTable (
|
||||||
PageTable = (UINT64 *)(UINTN)(PageTable[BitFieldRead64 (HookAddress, 39, 47)] & mPhyMask);
|
PageTable = (UINT64 *)(UINTN)(PageTable[BitFieldRead64 (HookAddress, 39, 47)] & mPhyMask);
|
||||||
PageTable = (UINT64 *)(UINTN)(PageTable[BitFieldRead64 (HookAddress, 30, 38)] & mPhyMask);
|
PageTable = (UINT64 *)(UINTN)(PageTable[BitFieldRead64 (HookAddress, 30, 38)] & mPhyMask);
|
||||||
|
|
||||||
PDPTE = (UINT64 *)(UINTN)PageTable;
|
Pdpte = (UINT64 *)(UINTN)PageTable;
|
||||||
PDE = PDPTE[BitFieldRead64 (HookAddress, 21, 29)];
|
Pde = Pdpte[BitFieldRead64 (HookAddress, 21, 29)];
|
||||||
ASSERT ((PDE & BIT0) != 0); // Present and 2M Page
|
ASSERT ((Pde & BIT0) != 0); // Present and 2M Page
|
||||||
|
|
||||||
if ((PDE & BIT7) == 0) { // 4KB Page Directory
|
if ((Pde & BIT7) == 0) { // 4KB Page Directory
|
||||||
PageTable = (UINT64 *)(UINTN)(PDE & mPhyMask);
|
PageTable = (UINT64 *)(UINTN)(Pde & mPhyMask);
|
||||||
} else {
|
} else {
|
||||||
ASSERT ((PDE & mPhyMask) == (HookAddress & ~(SIZE_2MB-1))); // 2MB Page Point to HookAddress
|
ASSERT ((Pde & mPhyMask) == (HookAddress & ~(SIZE_2MB-1))); // 2MB Page Point to HookAddress
|
||||||
PageTable = AllocatePages (1);
|
PageTable = AllocatePages (1);
|
||||||
Address = HookAddress & ~(SIZE_2MB-1);
|
Address = HookAddress & ~(SIZE_2MB-1);
|
||||||
for (Index = 0; Index < 512; Index++) {
|
for (Index = 0; Index < 512; Index++) {
|
||||||
PageTable[Index] = Address | BIT0 | BIT1; // Present and RW
|
PageTable[Index] = Address | BIT0 | BIT1; // Present and RW
|
||||||
Address += SIZE_4KB;
|
Address += SIZE_4KB;
|
||||||
}
|
}
|
||||||
PDPTE[BitFieldRead64 (HookAddress, 21, 29)] = (UINT64)(UINTN)PageTable | BIT0 | BIT1; // Present and RW
|
Pdpte[BitFieldRead64 (HookAddress, 21, 29)] = (UINT64)(UINTN)PageTable | BIT0 | BIT1; // Present and RW
|
||||||
}
|
}
|
||||||
return PageTable;
|
return PageTable;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue