diff options
author | Wei6 Xu <wei6.xu@intel.com> | 2025-03-23 02:03:50 +0800 |
---|---|---|
committer | Liming Gao <gaoliming@byosoft.com.cn> | 2025-03-26 09:59:01 +0800 |
commit | 95bf74fac1977a083234518933393939145160fc (patch) | |
tree | ebbf5d5b8cad7f6121012df276faa1d9f1f2e183 | |
parent | e01f4180b3d441bbea6a3974f07eb31c915a64b2 (diff) | |
download | edk2-95bf74fac1977a083234518933393939145160fc.zip edk2-95bf74fac1977a083234518933393939145160fc.tar.gz edk2-95bf74fac1977a083234518933393939145160fc.tar.bz2 |
MdeModulePkg/DxeCorePerformanceLib: Fix incorrect size calculation
The values of BootRecordDataPayloadSize and CommSize are incorrect.
BootRecordDataPayloadSize should equal to
SmmBootRecordDataSize - SmmBootRecordDataRetrieved
CommSize should equal to
OFFSET_OF (EFI_MM_COMMUNICATE_HEADER,Data) \
+ (UINTN)MmCommBufferHeader->MessageLength
SmmCommData->BootRecordSize should be set to BootRecordDataPayloadSize,
instead of the total size of entire Smm boot record data.
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
-rw-r--r-- | MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index 2d0de6e..7bf1ba7 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -320,11 +320,12 @@ InternalGetSmmPerfData ( // Note: Maximum comm buffer data payload size is ReservedMemSize - SMM_BOOT_RECORD_COMM_SIZE
BootRecordDataPayloadSize = MIN (
ReservedMemSize - SMM_BOOT_RECORD_COMM_SIZE,
- SmmBootRecordDataSize - SmmBootRecordDataRetrieved - SMM_BOOT_RECORD_COMM_SIZE
+ SmmBootRecordDataSize - SmmBootRecordDataRetrieved
);
+ SmmCommData->BootRecordSize = BootRecordDataPayloadSize;
MmCommBufferHeader->MessageLength = sizeof (SMM_BOOT_RECORD_COMMUNICATE) + BootRecordDataPayloadSize;
- CommSize = sizeof (EFI_MM_COMMUNICATE_HEADER) + (UINTN)MmCommBufferHeader->MessageLength;
+ CommSize = OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data) + (UINTN)MmCommBufferHeader->MessageLength;
Status = Communication->Communicate (Communication, SmmBootRecordCommBuffer, &CommSize);
ASSERT_EFI_ERROR (Status);
|