From 2d0e944d1c985a0d4639ee5d98c3c371cd63afa3 Mon Sep 17 00:00:00 2001 From: ths Date: Mon, 2 Apr 2007 15:54:05 +0000 Subject: [PATCH] Build fix for 64bit machines. (This is still not correct mul/div handling.) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2587 c046a42c-6fe2-441c-8c8c-71466251a162 --- target-mips/op_helper.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c index af3938798f..7b6442e8f8 100644 --- a/target-mips/op_helper.c +++ b/target-mips/op_helper.c @@ -17,6 +17,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "exec.h" #define MIPS_DEBUG_DISAS @@ -222,29 +223,34 @@ void do_msubu (void) #ifdef TARGET_MIPS64 void do_dmult (void) { + env->LO = (int64_t)T0 * (int64_t)T1; /* XXX */ - set_HILO((int64_t)T0 * (int64_t)T1); + env->HI = (env->LO | (1ULL << 63)) ? ~0ULL : 0ULL; } void do_dmultu (void) { + env->LO = T0 * T1; /* XXX */ - set_HILO((uint64_t)T0 * (uint64_t)T1); + env->HI = 0; } void do_ddiv (void) { if (T1 != 0) { - env->LO = (int64_t)T0 / (int64_t)T1; - env->HI = (int64_t)T0 % (int64_t)T1; + lldiv_t res = lldiv((int64_t)T0, (int64_t)T1); + env->LO = res.quot; + env->HI = res.rem; } } void do_ddivu (void) { if (T1 != 0) { - env->LO = T0 / T1; - env->HI = T0 % T1; + /* XXX: lldivu? */ + lldiv_t res = lldiv(T0, T1); + env->LO = (uint64_t)res.quot; + env->HI = (uint64_t)res.rem; } } #endif