Skip to content

Commit

Permalink
UefiCpuPkg: Remove duplicate code in SmiPfHandler
Browse files Browse the repository at this point in the history
In this commit, we remove duplicate CpuDeadLoop in
SmiPfHandler where mCpuSmmRestrictedMemoryAccess is
TRUE.
With last commit, we always call CpuDeadLoop if SMM
profile is disabled. Then the CpuDeadLoop calling
for the condition (mCpuSmmRestrictedMemoryAccess &&
IsSmmCommBufferForbiddenAddress (PFAddress)) is not
needed anymore. We also modify the IA32 related code
to be aligned with X64.

Signed-off-by: Dun Tan <[email protected]>
  • Loading branch information
td36 authored and mergify[bot] committed Aug 5, 2024
1 parent b5c9bbf commit cae90a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
9 changes: 3 additions & 6 deletions UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,7 @@ SmiPFHandler (
}

if (IsSmmCommBufferForbiddenAddress (PFAddress)) {
DumpCpuContext (InterruptType, SystemContext);
DEBUG ((DEBUG_ERROR, "Access SMM communication forbidden address (0x%x)!\n", PFAddress));
DEBUG_CODE (
DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextIa32->Eip);
);
CpuDeadLoop ();
goto Exit;
}
}

Expand All @@ -212,6 +206,9 @@ SmiPFHandler (
);
} else {
DumpCpuContext (InterruptType, SystemContext);
DEBUG_CODE (
DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextIa32->Eip);
);
CpuDeadLoop ();
}

Expand Down
9 changes: 3 additions & 6 deletions UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -966,13 +966,7 @@ SmiPFHandler (
}

if (mCpuSmmRestrictedMemoryAccess && IsSmmCommBufferForbiddenAddress (PFAddress)) {
DumpCpuContext (InterruptType, SystemContext);
DEBUG ((DEBUG_ERROR, "Access SMM communication forbidden address (0x%lx)!\n", PFAddress));
DEBUG_CODE (
DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextX64->Rip);
);
CpuDeadLoop ();
goto Exit;
}
}

Expand All @@ -983,6 +977,9 @@ SmiPFHandler (
);
} else {
DumpCpuContext (InterruptType, SystemContext);
DEBUG_CODE (
DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextX64->Rip);
);
CpuDeadLoop ();
}

Expand Down

0 comments on commit cae90a8

Please sign in to comment.