Commit 2d0e944d1c985a0d4639ee5d98c3c371cd63afa3
1 parent
23be50f1
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
Showing
1 changed file
with
12 additions
and
6 deletions
target-mips/op_helper.c
@@ -17,6 +17,7 @@ | @@ -17,6 +17,7 @@ | ||
17 | * License along with this library; if not, write to the Free Software | 17 | * License along with this library; if not, write to the Free Software |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ | 19 | */ |
20 | +#include <stdlib.h> | ||
20 | #include "exec.h" | 21 | #include "exec.h" |
21 | 22 | ||
22 | #define MIPS_DEBUG_DISAS | 23 | #define MIPS_DEBUG_DISAS |
@@ -222,29 +223,34 @@ void do_msubu (void) | @@ -222,29 +223,34 @@ void do_msubu (void) | ||
222 | #ifdef TARGET_MIPS64 | 223 | #ifdef TARGET_MIPS64 |
223 | void do_dmult (void) | 224 | void do_dmult (void) |
224 | { | 225 | { |
226 | + env->LO = (int64_t)T0 * (int64_t)T1; | ||
225 | /* XXX */ | 227 | /* XXX */ |
226 | - set_HILO((int64_t)T0 * (int64_t)T1); | 228 | + env->HI = (env->LO | (1ULL << 63)) ? ~0ULL : 0ULL; |
227 | } | 229 | } |
228 | 230 | ||
229 | void do_dmultu (void) | 231 | void do_dmultu (void) |
230 | { | 232 | { |
233 | + env->LO = T0 * T1; | ||
231 | /* XXX */ | 234 | /* XXX */ |
232 | - set_HILO((uint64_t)T0 * (uint64_t)T1); | 235 | + env->HI = 0; |
233 | } | 236 | } |
234 | 237 | ||
235 | void do_ddiv (void) | 238 | void do_ddiv (void) |
236 | { | 239 | { |
237 | if (T1 != 0) { | 240 | if (T1 != 0) { |
238 | - env->LO = (int64_t)T0 / (int64_t)T1; | ||
239 | - env->HI = (int64_t)T0 % (int64_t)T1; | 241 | + lldiv_t res = lldiv((int64_t)T0, (int64_t)T1); |
242 | + env->LO = res.quot; | ||
243 | + env->HI = res.rem; | ||
240 | } | 244 | } |
241 | } | 245 | } |
242 | 246 | ||
243 | void do_ddivu (void) | 247 | void do_ddivu (void) |
244 | { | 248 | { |
245 | if (T1 != 0) { | 249 | if (T1 != 0) { |
246 | - env->LO = T0 / T1; | ||
247 | - env->HI = T0 % T1; | 250 | + /* XXX: lldivu? */ |
251 | + lldiv_t res = lldiv(T0, T1); | ||
252 | + env->LO = (uint64_t)res.quot; | ||
253 | + env->HI = (uint64_t)res.rem; | ||
248 | } | 254 | } |
249 | } | 255 | } |
250 | #endif | 256 | #endif |