audk/MdeModulePkg/Universal/Acpi
Laszlo Ersek 387ccad8f6 MdeModulePkg: S3SaveStateDxe, SmmS3SaveState: save 64-bit LoopTimes
The BootScriptWriteMemPoll() helper function in both drivers does the
following:

- pop Delay from the variable argument list as UINT64, then truncate it to
  UINTN,

- divide Delay by 10, using DivU64x32Remainder(), then store the quotient
  in LoopTimes (also UINTN),

- pass LoopTimes to S3BootScriptSaveMemPoll() as last argument.

The truncation to UINTN is superfluous and wrong in this logic (not to
mention incompatible with the PI spec); it prevents callers from
specifying Delays longer than 0xFFFF_FFFF * 100ns (approximately 429
seconds == 7 minutes 9 seconds) on Ia32. In particular it prevents callers
from specifying an infinite timeout (for example, 0xFFFF_FFFF_FFFF_FFFF *
100ns, approximately 58494 years).

Change the type of Delay and LoopTimes to UINT64. Keep the same logic,
just remove the truncations. The resultant LoopTimes values can be safely
passed to S3BootScriptSaveMemPoll() thanks to the previous patch.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
2017-01-03 12:23:38 +01:00
..
AcpiPlatformDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
AcpiTableDxe MdeModulePkg: Add description to MdeModulePkg AcpiTable driver. 2016-04-27 14:41:36 +08:00
BootGraphicsResourceTableDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
BootScriptExecutorDxe MdeModulePkg/Universal: Fix typos in comments 2016-10-27 09:11:19 +08:00
FirmwarePerformanceDataTableDxe MdeModulePkg-FPDT(3): Use SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET in FpdtDxe. 2016-04-29 12:49:20 +08:00
FirmwarePerformanceDataTablePei MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
FirmwarePerformanceDataTableSmm MdeModulePkg-FPDT(2): Add SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET in FpdtSmm Handler. 2016-04-29 12:49:18 +08:00
S3SaveStateDxe MdeModulePkg: S3SaveStateDxe, SmmS3SaveState: save 64-bit LoopTimes 2017-01-03 12:23:38 +01:00
SmmS3SaveState MdeModulePkg: S3SaveStateDxe, SmmS3SaveState: save 64-bit LoopTimes 2017-01-03 12:23:38 +01:00