]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: VirtioBlkDxe: fix div & mod of 64-bit dividends on IA32/gcc-4.4
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 14 Oct 2012 21:17:20 +0000 (21:17 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 14 Oct 2012 21:17:20 +0000 (21:17 +0000)
OvmfPkg/VirtioBlkDxe/VirtioBlk.c:667: undefined reference to `__umoddi3'
OvmfPkg/VirtioBlkDxe/VirtioBlk.c:750: undefined reference to `__udivdi3'

These operations would come from libgcc in the IA32 build, but OVMF does not
link against libgcc.

Regression-tested the X64 build with Fedora 18 Alpha XFCE and Windows 8
Consumer Preview guests.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13846 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/VirtioBlkDxe/VirtioBlk.c

index 86041f0cafe9a4e3f89844cb1ddda2c07996ee10..1ac36cd17b486b7a6b00b7f6d870e40f564eb4d0 100644 (file)
@@ -664,7 +664,7 @@ VirtioBlkInit (
       goto Failed;\r
     }\r
     if (BlockSize == 0 || BlockSize % 512 != 0 ||\r
-        NumSectors % (BlockSize / 512) != 0) {\r
+        ModU64x32 (NumSectors, BlockSize / 512) != 0) {\r
       //\r
       // We can only handle a logical block consisting of whole sectors,\r
       // and only a disk composed of whole logical blocks.\r
@@ -747,7 +747,8 @@ VirtioBlkInit (
   Dev->BlockIoMedia.WriteCaching     = !!(Features & VIRTIO_BLK_F_FLUSH);\r
   Dev->BlockIoMedia.BlockSize        = BlockSize;\r
   Dev->BlockIoMedia.IoAlign          = 0;\r
-  Dev->BlockIoMedia.LastBlock        = NumSectors / (BlockSize / 512) - 1;\r
+  Dev->BlockIoMedia.LastBlock        = DivU64x32 (NumSectors,\r
+                                         BlockSize / 512) - 1;\r
   return EFI_SUCCESS;\r
 \r
 ReleaseQueue:\r