summaryrefslogtreecommitdiff
path: root/OvmfPkg/QemuFlashFvbServicesRuntimeDxe
diff options
context:
space:
mode:
authorScott Duplichan <scott@notabs.org>2014-11-14 10:23:43 +0000
committerlersek <lersek@Edk2>2014-11-14 10:23:43 +0000
commitf7e899c7c74e5983e40e32257b33918ea6f466f0 (patch)
treeb58632a8a2c5498f123cbb0c9368f7b4f0e99421 /OvmfPkg/QemuFlashFvbServicesRuntimeDxe
parent1c5901528147af6f2d095a7b7d4bb73e19eeb365 (diff)
downloadedk2-platforms-f7e899c7c74e5983e40e32257b33918ea6f466f0.tar.xz
OvmfPkg: flash driver: drop needlessly wide multiplication (VS2010)
The current types of subexpressions used in QemuFlashPtr() are as follows. (We also show the types of "larger" subexpressions, according to operator binding.) mFlashBase + (Lba * mFdBlockSize) + Offset ^ ^ ^ ^ | | | | (UINT8*) EFI_LBA UINTN UINTN (UINT64) --------------------------------- ------ (UINT8*) UINTN ------------------------------------------ (UINT8*) When building with VS2010 for Ia32 / NOOPT, the 64-by-32 bit multiplication is translated to an intrinsic, which is not allowed in edk2. Recognize that "Lba" is always bounded by "mFdBlockCount" (an UINTN) here -- all callers of QemuFlashPtr() ensure that. In addition, the flash chip in question is always under 4GB, which is why we can address it at all on Ia32. Narrow "Lba" to UINTN, without any loss of range. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Scott Duplichan <scott@notabs.org> [commit message by lersek@redhat.com] Signed-off-by: Laszlo Ersek <lersek@redhat.com> Build-tested-by: Scott Duplichan <scott@notabs.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16384 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/QemuFlashFvbServicesRuntimeDxe')
-rw-r--r--OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c
index f9c6f5c553..a96e0e5275 100644
--- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c
+++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c
@@ -54,7 +54,7 @@ QemuFlashPtr (
IN UINTN Offset
)
{
- return mFlashBase + (Lba * mFdBlockSize) + Offset;
+ return mFlashBase + ((UINTN)Lba * mFdBlockSize) + Offset;
}