summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/PiSmmCpuDxeSmm
diff options
context:
space:
mode:
authorMark Wilson <Mark.Wilson@amd.com>2020-11-13 08:05:18 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-09-01 06:07:56 +0000
commitb170806518c1e414939c8b085866544814e1ce8e (patch)
tree89c8cd91cee4fdc540d633907ae04bd841eed4c4 /UefiCpuPkg/PiSmmCpuDxeSmm
parent3b3f88228812e2c642eea8746858a4dad928ebf7 (diff)
downloadedk2-b170806518c1e414939c8b085866544814e1ce8e.tar.gz
edk2-b170806518c1e414939c8b085866544814e1ce8e.tar.bz2
edk2-b170806518c1e414939c8b085866544814e1ce8e.zip
UefiCpuPkg: Clean up save state boundary checks and comments.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2956 In functions ReadSaveStateRegisterByIndex and WriteSaveStateRegister: * check width > 4 instead of >= 4 when writing upper 32 bytes. - This improves the code but will not affect functionality. Cc: Eric Dong <eric.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Signed-off-by: Mark Wilson <Mark.Wilson@amd.com>
Diffstat (limited to 'UefiCpuPkg/PiSmmCpuDxeSmm')
-rw-r--r--UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c
index fc418c2500..518978c1d9 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c
@@ -315,12 +315,12 @@ ReadSaveStateRegisterByIndex (
}
//
- // Write lower 32-bits of return buffer
+ // Write at most 4 of the lower bytes of the return buffer
//
CopyMem(Buffer, (UINT8 *)CpuSaveState + mSmmCpuWidthOffset[RegisterIndex].Offset64Lo, MIN(4, Width));
- if (Width >= 4) {
+ if (Width > 4) {
//
- // Write upper 32-bits of return buffer
+ // Write at most 4 of the upper bytes of the return buffer
//
CopyMem((UINT8 *)Buffer + 4, (UINT8 *)CpuSaveState + mSmmCpuWidthOffset[RegisterIndex].Offset64Hi, Width - 4);
}
@@ -546,12 +546,12 @@ WriteSaveStateRegister (
}
//
- // Write lower 32-bits of SMM State register
+ // Write at most 4 of the lower bytes of SMM State register
//
CopyMem((UINT8 *)CpuSaveState + mSmmCpuWidthOffset[RegisterIndex].Offset64Lo, Buffer, MIN (4, Width));
- if (Width >= 4) {
+ if (Width > 4) {
//
- // Write upper 32-bits of SMM State register
+ // Write at most 4 of the upper bytes of SMM State register
//
CopyMem((UINT8 *)CpuSaveState + mSmmCpuWidthOffset[RegisterIndex].Offset64Hi, (UINT8 *)Buffer + 4, Width - 4);
}