mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 21:54:27 +02:00
UefiCpuPkg/PiSmmCpuDxeSmm: Check logging PF address for MM
This patch is to make sure only logging PF address for MM can run into the SmmProfilePFHandler. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Dun Tan <dun.tan@intel.com> Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Yuanhao Xie <yuanhao.xie@intel.com>
This commit is contained in:
parent
0593183d76
commit
3690d30a6e
@ -460,6 +460,24 @@ GetSmmProfileData (
|
|||||||
return Base;
|
return Base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return if the Address is the NonMmram logging Address.
|
||||||
|
|
||||||
|
@param[in] Address the address to be checked
|
||||||
|
|
||||||
|
@return TRUE The address is the NonMmram logging Address.
|
||||||
|
@return FALSE The address is not the NonMmram logging Address.
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
IsNonMmramLoggingAddress (
|
||||||
|
IN UINT64 Address
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return if the Address is forbidden as SMM communication buffer.
|
Return if the Address is forbidden as SMM communication buffer.
|
||||||
|
|
||||||
|
@ -46,6 +46,38 @@ GetSmmProfileData (
|
|||||||
return SmmProfileDataHob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress;
|
return SmmProfileDataHob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return if the Address is the NonMmram logging Address.
|
||||||
|
|
||||||
|
@param[in] Address the address to be checked
|
||||||
|
|
||||||
|
@return TRUE The address is the NonMmram logging Address.
|
||||||
|
@return FALSE The address is not the NonMmram logging Address.
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
IsNonMmramLoggingAddress (
|
||||||
|
IN UINT64 Address
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_PEI_HOB_POINTERS Hob;
|
||||||
|
|
||||||
|
Hob.Raw = GetFirstHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR);
|
||||||
|
while (Hob.Raw != NULL) {
|
||||||
|
if ((Address >= Hob.ResourceDescriptor->PhysicalStart) && (Address < Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength)) {
|
||||||
|
if ((Hob.ResourceDescriptor->ResourceAttribute & MM_RESOURCE_ATTRIBUTE_LOGGING) != 0) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Hob.Raw = GET_NEXT_HOB (Hob);
|
||||||
|
Hob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, Hob.Raw);
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return if the Address is forbidden as SMM communication buffer.
|
Return if the Address is forbidden as SMM communication buffer.
|
||||||
|
|
||||||
|
@ -979,6 +979,19 @@ GetSmmProfileData (
|
|||||||
IN OUT UINT64 *Size
|
IN OUT UINT64 *Size
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return if the Address is the NonMmram logging Address.
|
||||||
|
|
||||||
|
@param[in] Address the address to be checked
|
||||||
|
|
||||||
|
@return TRUE The address is the NonMmram logging Address.
|
||||||
|
@return FALSE The address is not the NonMmram logging Address.
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
IsNonMmramLoggingAddress (
|
||||||
|
IN UINT64 Address
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return if the Address is forbidden as SMM communication buffer.
|
Return if the Address is forbidden as SMM communication buffer.
|
||||||
|
|
||||||
|
@ -821,6 +821,13 @@ SmiPFHandler (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (FeaturePcdGet (PcdCpuSmmProfileEnable)) {
|
if (FeaturePcdGet (PcdCpuSmmProfileEnable)) {
|
||||||
|
if (mIsStandaloneMm) {
|
||||||
|
//
|
||||||
|
// Only logging ranges shall run here in MM env.
|
||||||
|
//
|
||||||
|
ASSERT (IsNonMmramLoggingAddress (PFAddress));
|
||||||
|
}
|
||||||
|
|
||||||
SmmProfilePFHandler (
|
SmmProfilePFHandler (
|
||||||
SystemContext.SystemContextX64->Rip,
|
SystemContext.SystemContextX64->Rip,
|
||||||
SystemContext.SystemContextX64->ExceptionData
|
SystemContext.SystemContextX64->ExceptionData
|
||||||
|
Loading…
x
Reference in New Issue
Block a user