projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6d35524
)
Avoid host FPE for overflowing division on MIPS, by Richard Sandiford.
author
ths
<ths@c046a42c-6fe2-441c-8c8c-71466251a162>
Tue, 25 Dec 2007 03:18:19 +0000
(
03:18
+0000)
committer
ths
<ths@c046a42c-6fe2-441c-8c8c-71466251a162>
Tue, 25 Dec 2007 03:18:19 +0000
(
03:18
+0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3856
c046a42c
-6fe2-441c-8c8c-
71466251a162
target-mips/op_helper.c
patch
|
blob
|
history
diff --git
a/target-mips/op_helper.c
b/target-mips/op_helper.c
index 032302161149b13534ef139eb21ff70de7a4b3f8..36c4b73f93ac9421da8e7525f1e02e0161aaae56 100644
(file)
--- a/
target-mips/op_helper.c
+++ b/
target-mips/op_helper.c
@@
-230,9
+230,16
@@
void do_div (void)
void do_ddiv (void)
{
if (T1 != 0) {
- lldiv_t res = lldiv((int64_t)T0, (int64_t)T1);
- env->LO[0][env->current_tc] = res.quot;
- env->HI[0][env->current_tc] = res.rem;
+ int64_t arg0 = (int64_t)T0;
+ int64_t arg1 = (int64_t)T1;
+ if (arg0 == ((int64_t)-1 << 63) && arg1 == (int64_t)-1) {
+ env->LO[0][env->current_tc] = arg0;
+ env->HI[0][env->current_tc] = 0;
+ } else {
+ lldiv_t res = lldiv(arg0, arg1);
+ env->LO[0][env->current_tc] = res.quot;
+ env->HI[0][env->current_tc] = res.rem;
+ }
}
}