summaryrefslogtreecommitdiff
path: root/target-mips/op_helper.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-04-02 15:54:05 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-04-02 15:54:05 +0000
commit2d0e944d1c985a0d4639ee5d98c3c371cd63afa3 (patch)
tree84a9db75586ff00021b5f5b64d93f4ce2e9cbdb0 /target-mips/op_helper.c
parent23be50f1afbb8c3db746ecd7735f74eacc89db24 (diff)
downloadqemu-2d0e944d1c985a0d4639ee5d98c3c371cd63afa3.tar.gz
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
Diffstat (limited to 'target-mips/op_helper.c')
-rw-r--r--target-mips/op_helper.c18
1 files 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 <stdlib.h>
#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