Received: from eggs.gnu.org ([208.118.235.92]:55427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVnHQ-0003Qt-97 for qemu-devel@nongnu.org; Fri, 26 Apr 2013 14:22:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVnHL-0004yj-VH for qemu-devel@nongnu.org; Fri, 26 Apr 2013 14:21:56 -0400 From: Alexander Graf Date: Fri, 26 Apr 2013 20:21:38 +0200 Message-Id: <1367000509-8833-20-git-send-email-agraf@suse.de> In-Reply-To: <1367000509-8833-1-git-send-email-agraf@suse.de> References: <1367000509-8833-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH 19/30] powerpc: correctly handle fpu exceptions. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-ppc@nongnu.org Cc: Blue Swirl , Tristan Gingold , Fabien Chouteau , qemu-devel@nongnu.org, Aurelien Jarno From: Tristan Gingold Raise the exception on the first occurence, do not wait for the next floating point operation. Signed-off-by: Fabien Chouteau Signed-off-by: Alexander Graf --- target-ppc/fpu_helper.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-) diff --git a/target-ppc/fpu_helper.c b/target-ppc/fpu_helper.c index 9e779ea..1e141fb 100644 --- a/target-ppc/fpu_helper.c +++ b/target-ppc/fpu_helper.c @@ -470,6 +470,18 @@ void store_fpscr(CPUPPCState *env, uint64_t arg, uint32_t mask) void helper_float_check_status(CPUPPCState *env) { + int status = get_float_exception_flags(&env->fp_status); + + if (status & float_flag_divbyzero) { + float_zero_divide_excp(env); + } else if (status & float_flag_overflow) { + float_overflow_excp(env); + } else if (status & float_flag_underflow) { + float_underflow_excp(env); + } else if (status & float_flag_inexact) { + float_inexact_excp(env); + } + if (env->exception_index == POWERPC_EXCP_PROGRAM && (env->error_code & POWERPC_EXCP_FP)) { /* Differred floating-point exception after target FPR update */ @@ -477,17 +489,6 @@ void helper_float_check_status(CPUPPCState *env) helper_raise_exception_err(env, env->exception_index, env->error_code); } - } else { - int status = get_float_exception_flags(&env->fp_status); - if (status & float_flag_divbyzero) { - float_zero_divide_excp(env); - } else if (status & float_flag_overflow) { - float_overflow_excp(env); - } else if (status & float_flag_underflow) { - float_underflow_excp(env); - } else if (status & float_flag_inexact) { - float_inexact_excp(env); - } } } -- 1.6.0.2