In the InitializeVariableFvHeader() function, all three of "Offset", "Start" and "BlockSize" have type UINTN. Therefore the (Offset / BlockSize) and (Start / BlockSize) divisions can be compiled on all platforms without intrinsics.
In the current expressions (EFI_LBA) Offset / BlockSize (EFI_LBA) Start / BlockSize "Offset" and "Start" are cast to UINT64 (== EFI_LBA), which leads to 64-by-32 bit divisions on Ia32, breaking the VS2010 / NOOPT / Ia32 build. The simplest way to fix them is to realize we don't need casts at all. (The prototypes of QemuFlashEraseBlock() and QemuFlashWrite() are visible via "QemuFlash.h", and they will easily take our UINTN quotients as UINT64.) Suggested-by: Scott Duplichan <sc...@notabs.org> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <ler...@redhat.com> --- Notes: v2: - covered another division, reported by Scott OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c index 42060c8..9160bb8 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c @@ -979,7 +979,7 @@ InitializeVariableFvHeader ( // Erase all the blocks // for (Offset = Start; Offset < Start + Length; Offset += BlockSize) { - Status = QemuFlashEraseBlock ((EFI_LBA) Offset / BlockSize); + Status = QemuFlashEraseBlock (Offset / BlockSize); ASSERT_EFI_ERROR (Status); } @@ -988,7 +988,7 @@ InitializeVariableFvHeader ( // WriteLength = GoodFwVolHeader->HeaderLength; Status = QemuFlashWrite ( - (EFI_LBA) Start / BlockSize, + Start / BlockSize, 0, &WriteLength, (UINT8 *) GoodFwVolHeader); -- 1.8.3.1 ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel