65a4e8
commit 2fe74ef339c3a4902ae8214f5a0454662895422c
65a4e8
Author: Matthias Hopf <mhopf@suse.de>
65a4e8
Date:   Thu Mar 15 16:56:01 2007 +0100
65a4e8
65a4e8
    Fix calculations in x86 emulator for the long long case (Andreas Schwab).
65a4e8
65a4e8
diff --git a/hw/xfree86/x86emu/prim_ops.c b/hw/xfree86/x86emu/prim_ops.c
65a4e8
index 461e09e..b9e7257 100644
65a4e8
--- a/hw/xfree86/x86emu/prim_ops.c
65a4e8
+++ b/hw/xfree86/x86emu/prim_ops.c
65a4e8
@@ -2082,7 +2082,7 @@ Implements the IMUL instruction and side effects.
65a4e8
 void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s)
65a4e8
 {
65a4e8
 #ifdef	__HAS_LONG_LONG__
65a4e8
-	s64 res = (s32)d * (s32)s;
65a4e8
+	s64 res = (s64)(s32)d * (s32)s;
65a4e8
 
65a4e8
 	*res_lo = (u32)res;
65a4e8
 	*res_hi = (u32)(res >> 32);
65a4e8
@@ -2174,7 +2174,7 @@ Implements the MUL instruction and side effects.
65a4e8
 void mul_long(u32 s)
65a4e8
 {
65a4e8
 #ifdef	__HAS_LONG_LONG__
65a4e8
-	u64 res = (u32)M.x86.R_EAX * (u32)s;
65a4e8
+	u64 res = (u64)M.x86.R_EAX * s;
65a4e8
 
65a4e8
 	M.x86.R_EAX = (u32)res;
65a4e8
 	M.x86.R_EDX = (u32)(res >> 32);