diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c index 470c710755f..be3c1e051b5 100644 --- a/target-sparc/op_helper.c +++ b/target-sparc/op_helper.c @@ -3306,7 +3306,7 @@ target_ulong helper_udiv(target_ulong a, target_ulong b) uint32_t x1; x0 = (a & 0xffffffff) | ((int64_t) (env->y) << 32); - x1 = b; + x1 = (b & 0xffffffff); if (x1 == 0) { raise_exception(TT_DIV_ZERO); @@ -3328,7 +3328,7 @@ target_ulong helper_sdiv(target_ulong a, target_ulong b) int32_t x1; x0 = (a & 0xffffffff) | ((int64_t) (env->y) << 32); - x1 = b; + x1 = (b & 0xffffffff); if (x1 == 0) { raise_exception(TT_DIV_ZERO);