Skip to content

Commit

Permalink
Core/Dxe: Refactored DisableSMAP(), EnableSMAP() names.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Krichanov committed Sep 2, 2024
1 parent c820082 commit d8b5a6d
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 135 deletions.
4 changes: 2 additions & 2 deletions MdeModulePkg/Core/Dxe/DxeMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -2743,13 +2743,13 @@ CallRing3 (

VOID
EFIAPI
DisableSMAP (
AllowSupervisorAccessToUserMemory (
VOID
);

VOID
EFIAPI
EnableSMAP (
ForbidSupervisorAccessToUserMemory (
VOID
);

Expand Down
4 changes: 2 additions & 2 deletions MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -762,14 +762,14 @@ CoreExitBootServices (
// Free resources allocated for Ring3.
//
if (gRing3Data != NULL) {
DisableSMAP ();
AllowSupervisorAccessToUserMemory ();
if (gRing3Data->SystemTable.ConfigurationTable != NULL) {
CoreFreePages (
(EFI_PHYSICAL_ADDRESS)(UINTN)gRing3Data->SystemTable.ConfigurationTable,
EFI_SIZE_TO_PAGES (gRing3Data->SystemTable.NumberOfTableEntries * sizeof (EFI_CONFIGURATION_TABLE))
);
}
EnableSMAP ();
ForbidSupervisorAccessToUserMemory ();

CoreFreePages (
(EFI_PHYSICAL_ADDRESS)(UINTN)gRing3Data,
Expand Down
8 changes: 4 additions & 4 deletions MdeModulePkg/Core/Dxe/SysCall/AARCH64/InitializeMsr.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ SysCallBootService (
return Status;
}

DisableSMAP ();
AllowSupervisorAccessToUserMemory ();
CopyMem ((VOID *)((UINTN)Physical + sizeof (UINTN)), (VOID *)UserRsp, 8 * sizeof (UINTN));

SetUefiImageMemoryAttributes (
gUartBaseAddress,
EFI_PAGE_SIZE,
EFI_MEMORY_XP
);
EnableSMAP ();
ForbidSupervisorAccessToUserMemory ();

Status = CallBootService (
Type,
Expand Down Expand Up @@ -180,7 +180,7 @@ InitializeMsr (

VOID
EFIAPI
DisableSMAP (
AllowSupervisorAccessToUserMemory (
VOID
)
{
Expand All @@ -191,7 +191,7 @@ DisableSMAP (

VOID
EFIAPI
EnableSMAP (
ForbidSupervisorAccessToUserMemory (
VOID
)
{
Expand Down
11 changes: 4 additions & 7 deletions MdeModulePkg/Core/Dxe/SysCall/ARM/InitializeMsr.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ SysCallBootService (
return Status;
}

DisableSMAP ();
AllowSupervisorAccessToUserMemory ();
//
// First 3 arguments are passed through R1-R3 and copied to SysCall Stack.
//
Expand All @@ -76,7 +76,7 @@ SysCallBootService (
// All remaining arguments are on User Stack.
//
CopyMem ((VOID *)((UINTN)Physical + 5 * sizeof (UINTN)), (VOID *)UserRsp, 4 * sizeof (UINTN));
EnableSMAP ();
ForbidSupervisorAccessToUserMemory ();

Status = CallBootService (
Type,
Expand Down Expand Up @@ -110,12 +110,9 @@ InitializeMsr (
InitializeSysCallHandler (SysCallBootService);
}

//
// TODO: Refactoring.
//
VOID
EFIAPI
DisableSMAP (
AllowSupervisorAccessToUserMemory (
VOID
)
{
Expand All @@ -126,7 +123,7 @@ DisableSMAP (

VOID
EFIAPI
EnableSMAP (
ForbidSupervisorAccessToUserMemory (
VOID
)
{
Expand Down
Loading

0 comments on commit d8b5a6d

Please sign in to comment.