From 3e0d0cfab734572d22072ceaa44ffe5647db4367 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Sat, 16 Dec 2017 10:28:45 +0800 Subject: [PATCH] i386: fix signed int overflow in #923 & #924 --- qemu/target-i386/ops_sse.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu/target-i386/ops_sse.h b/qemu/target-i386/ops_sse.h index 57b152c8..16225b1f 100644 --- a/qemu/target-i386/ops_sse.h +++ b/qemu/target-i386/ops_sse.h @@ -1417,7 +1417,7 @@ void glue(helper_phaddd, SUFFIX)(CPUX86State *env, Reg *d, Reg *s) { d->L(0) = (int32_t)d->L(0) + (int32_t)d->L(1); XMM_ONLY(d->L(1) = (int32_t)d->L(2) + (int32_t)d->L(3)); - d->L((1 << SHIFT) + 0) = (int32_t)s->L(0) + (int32_t)s->L(1); + d->L((1 << SHIFT) + 0) = (uint32_t)((int32_t)s->L(0) + (int32_t)s->L(1)); XMM_ONLY(d->L(3) = (int32_t)s->L(2) + (int32_t)s->L(3)); } @@ -1471,7 +1471,7 @@ void glue(helper_phsubd, SUFFIX)(CPUX86State *env, Reg *d, Reg *s) { d->L(0) = (int32_t)d->L(0) - (int32_t)d->L(1); XMM_ONLY(d->L(1) = (int32_t)d->L(2) - (int32_t)d->L(3)); - d->L((1 << SHIFT) + 0) = (int32_t)s->L(0) - (int32_t)s->L(1); + d->L((1 << SHIFT) + 0) = (uint32_t)((int32_t)s->L(0) - (int32_t)s->L(1)); XMM_ONLY(d->L(3) = (int32_t)s->L(2) - (int32_t)s->L(3)); }