diff mbox

[edk2,COMMIT] MdeModulePkg: ConSplitterDxe: use U64 mult/div wrappers in AbsPtr scaling

Message ID 1458133829-15247-1-git-send-email-lersek@redhat.com
State Accepted
Commit 25896aa391d04efecbee65bdf41a2de3660da440
Headers show

Commit Message

Laszlo Ersek March 16, 2016, 1:10 p.m. UTC
This is an emergency fix for UINT64 multiplications and divisions not
being done with the right BaseLib functions -- they break Ia32 builds.

Fixes: 30ed3422ab2de03abf7c1433ebb482f6e5e16f45
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

---

Notes:
    This patch has been pushed as 25896aa391d04efecbee65bdf41a2de3660da440.
    
    I guess I'm losing patience with this kind of build breakage. See also
    <http://thread.gmane.org/gmane.comp.bios.edk2.devel/8691/focus=8823>.

 MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c | 27 +++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

-- 
1.8.3.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
index af90d5e5e4c3..0d6808197b16 100644
--- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
+++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
@@ -4156,13 +4156,34 @@  ConSplitterAbsolutePointerGetState (
       // Rescale to Con Splitter virtual Absolute Pointer's resolution.
       //
       if (!(MinX == 0 && MaxX == 0)) {
-        State->CurrentX = VirtualMinX + (CurrentState.CurrentX * (VirtualMaxX - VirtualMinX)) / (MaxX - MinX);
+        State->CurrentX = VirtualMinX + DivU64x64Remainder (
+                                          MultU64x64 (
+                                            CurrentState.CurrentX,
+                                            VirtualMaxX - VirtualMinX
+                                            ),
+                                          MaxX - MinX,
+                                          NULL
+                                          );
       }
       if (!(MinY == 0 && MaxY == 0)) {
-        State->CurrentY = VirtualMinY + (CurrentState.CurrentY * (VirtualMaxY - VirtualMinY)) / (MaxY - MinY);
+        State->CurrentY = VirtualMinY + DivU64x64Remainder (
+                                          MultU64x64 (
+                                            CurrentState.CurrentY,
+                                            VirtualMaxY - VirtualMinY
+                                            ),
+                                          MaxY - MinY,
+                                          NULL
+                                          );
       }
       if (!(MinZ == 0 && MaxZ == 0)) {
-        State->CurrentZ = VirtualMinZ + (CurrentState.CurrentZ * (VirtualMaxZ - VirtualMinZ)) / (MaxZ - MinZ);
+        State->CurrentZ = VirtualMinZ + DivU64x64Remainder (
+                                          MultU64x64 (
+                                            CurrentState.CurrentZ,
+                                            VirtualMaxZ - VirtualMinZ
+                                            ),
+                                          MaxZ - MinZ,
+                                          NULL
+                                          );
       }
 
     } else if (Status == EFI_DEVICE_ERROR) {