Ring3: Fixed PAN page faults.

This commit is contained in:
Mikhail Krichanov 2024-10-01 19:26:04 +03:00
parent 51e767463a
commit 32768e43f3
5 changed files with 8 additions and 11 deletions

View File

@ -273,6 +273,10 @@ CommonCExceptionHandler (
IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
if (ArmHasPan ()) {
ArmClearPan ();
}
if (ExceptionType <= gMaxExceptionNumber) {
if (gExceptionHandlers[ExceptionType]) {
gExceptionHandlers[ExceptionType](ExceptionType, SystemContext);

View File

@ -256,8 +256,6 @@ DefaultExceptionHandler (
DEBUG ((DEBUG_ERROR, "PC 0x%012lx\n", SystemContext.SystemContextAArch64->ELR));
}
ArmClearPan ();
if ((UINT64 *)SystemContext.SystemContextAArch64->FP != 0) {
Idx = 0;

View File

@ -76,14 +76,14 @@ SysCallBootService (
(RING3_STACK *)(UINTN)Physical
);
CoreFreePages (Physical, EFI_SIZE_TO_PAGES (9 * sizeof (UINTN)));
SetUefiImageMemoryAttributes (
gUartBaseAddress,
EFI_PAGE_SIZE,
EFI_MEMORY_XP | EFI_MEMORY_USER
);
CoreFreePages (Physical, EFI_SIZE_TO_PAGES (9 * sizeof (UINTN)));
return Status;
}

View File

@ -79,14 +79,14 @@ SysCallBootService (
(RING3_STACK *)(UINTN)Physical
);
CoreFreePages (Physical, EFI_SIZE_TO_PAGES (9 * sizeof (UINTN)));
SetUefiImageMemoryAttributes (
gUartBaseAddress,
EFI_PAGE_SIZE,
EFI_MEMORY_XP | EFI_MEMORY_USER
);
CoreFreePages (Physical, EFI_SIZE_TO_PAGES (9 * sizeof (UINTN)));
return Status;
}

View File

@ -94,12 +94,7 @@ GoToRing3 (
);
}
#elif defined (MDE_CPU_AARCH64) || defined (MDE_CPU_ARM)
//
// Problem 2: Uart memory maped page is not allocated at the very beginnig
// and can be used for translation table later.
//
AllowSupervisorAccessToUserMemory ();
SetUefiImageMemoryAttributes (
gUartBaseAddress,
EFI_PAGE_SIZE,