From c2a4cb8396cd7d4bb3110df83fdd245fd4564923 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 16 Aug 2007 22:59:49 -0700 Subject: [PATCH] --- yaml --- r: 64087 b: refs/heads/master c: 405849610fd96b4f34cd1875c4c033228fea6c0f h: refs/heads/master i: 64085: a7b7742ed4a7aa324d16e913de15f47475945203 64083: 27704c9b3cbb2e3203efc47634ab3644df02f854 64079: bb9425e2361a40c44d0839572bb9773f9eee3e38 v: v3 --- [refs] | 2 +- trunk/include/asm-sparc/sfp-machine.h | 6 ++++++ trunk/include/asm-sparc64/sfp-machine.h | 2 ++ trunk/include/math-emu/op-common.h | 5 ++++- trunk/include/math-emu/soft-fp.h | 7 +++++++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index ff63351959b8..ef10952ea674 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8b224b813aad0231af62dc75d056aae83c9d4d12 +refs/heads/master: 405849610fd96b4f34cd1875c4c033228fea6c0f diff --git a/trunk/include/asm-sparc/sfp-machine.h b/trunk/include/asm-sparc/sfp-machine.h index ecfc86a4a725..266a42b8f99f 100644 --- a/trunk/include/asm-sparc/sfp-machine.h +++ b/trunk/include/asm-sparc/sfp-machine.h @@ -203,4 +203,10 @@ extern struct task_struct *last_task_used_math; #define FP_INHIBIT_RESULTS ((last_task_used_math->thread.fsr >> 23) & _fex) #endif +#ifdef CONFIG_SMP +#define FP_TRAPPING_EXCEPTIONS ((current->thread.fsr >> 23) & 0x1f) +#else +#define FP_TRAPPING_EXCEPTIONS ((last_task_used_math->thread.fsr >> 23) & 0x1f) +#endif + #endif diff --git a/trunk/include/asm-sparc64/sfp-machine.h b/trunk/include/asm-sparc64/sfp-machine.h index 89d42431efb5..c9331b02d9c8 100644 --- a/trunk/include/asm-sparc64/sfp-machine.h +++ b/trunk/include/asm-sparc64/sfp-machine.h @@ -88,4 +88,6 @@ #define FP_INHIBIT_RESULTS ((current_thread_info()->xfsr[0] >> 23) & _fex) +#define FP_TRAPPING_EXCEPTIONS ((current_thread_info()->xfsr[0] >> 23) & 0x1f) + #endif diff --git a/trunk/include/math-emu/op-common.h b/trunk/include/math-emu/op-common.h index 93780abd01bc..bb46e7645d53 100644 --- a/trunk/include/math-emu/op-common.h +++ b/trunk/include/math-emu/op-common.h @@ -145,13 +145,16 @@ do { \ { \ X##_e = 1; \ _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \ + FP_SET_EXCEPTION(FP_EX_INEXACT); \ } \ else \ { \ X##_e = 0; \ _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \ - FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \ } \ + if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) || \ + (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \ + FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \ } \ else \ { \ diff --git a/trunk/include/math-emu/soft-fp.h b/trunk/include/math-emu/soft-fp.h index d02eb64a865b..a0721ef5c2f9 100644 --- a/trunk/include/math-emu/soft-fp.h +++ b/trunk/include/math-emu/soft-fp.h @@ -97,12 +97,19 @@ #define FP_INHIBIT_RESULTS 0 #endif +#ifndef FP_TRAPPING_EXCEPTIONS +#define FP_TRAPPING_EXCPETIONS 0 +#endif + #define FP_SET_EXCEPTION(ex) \ _fex |= (ex) #define FP_UNSET_EXCEPTION(ex) \ _fex &= ~(ex) +#define FP_CUR_EXCEPTIONS \ + (_fex) + #define FP_CLEAR_EXCEPTIONS \ _fex = 0