diff mbox

[09/32] ppc: Make float_invalid_op_excp() pass the return address

Message ID 1469571686-7284-9-git-send-email-benh@kernel.crashing.org
State New
Headers show

Commit Message

Benjamin Herrenschmidt July 26, 2016, 10:21 p.m. UTC
Instead of relying on NIP having been updated already

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 target-ppc/fpu_helper.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Richard Henderson July 28, 2016, 4:06 p.m. UTC | #1
On 07/27/2016 03:51 AM, Benjamin Herrenschmidt wrote:
> +            /* GETPC() works here because this is inline */
> +            raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM,
> +                                   POWERPC_EXCP_FP | op, GETPC());

It doesn't, with --enable-debug, aka -O0.


r~
Benjamin Herrenschmidt July 28, 2016, 9:57 p.m. UTC | #2
On Thu, 2016-07-28 at 21:36 +0530, Richard Henderson wrote:
> On 07/27/2016 03:51 AM, Benjamin Herrenschmidt wrote:

> > 

> > +            /* GETPC() works here because this is inline */

> > +            raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM,

> > +                                   POWERPC_EXCP_FP | op, GETPC());

> 

> It doesn't, with --enable-debug, aka -O0.


Will that prevent even an explicit inline statement ? Would
__attribute__((always_inline)) help there ?

Cheers,
Ben.
Benjamin Herrenschmidt July 28, 2016, 10:10 p.m. UTC | #3
On Fri, 2016-07-29 at 07:57 +1000, Benjamin Herrenschmidt wrote:
> On Thu, 2016-07-28 at 21:36 +0530, Richard Henderson wrote:

> > 

> > On 07/27/2016 03:51 AM, Benjamin Herrenschmidt wrote:

> > > 

> > > 

> > > +            /* GETPC() works here because this is inline */

> > > +            raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM,

> > > +                                   POWERPC_EXCP_FP | op,

> > > GETPC());

> > 

> > It doesn't, with --enable-debug, aka -O0.

> 

> Will that prevent even an explicit inline statement ? Would

> __attribute__((always_inline)) help there ?


Ah found this in gcc docs:

<<
GCC does not inline any functions when not optimizing unless you
specify the ‘always_inline’ attribute for the function, like this:

     /* Prototype.  */
     inline void foo (const char) __attribute__((always_inline));
>>


I'll add the attribute.

Cheers,
Ben.
diff mbox

Patch

diff --git a/target-ppc/fpu_helper.c b/target-ppc/fpu_helper.c
index e1f600a..8d881fc 100644
--- a/target-ppc/fpu_helper.c
+++ b/target-ppc/fpu_helper.c
@@ -19,6 +19,7 @@ 
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
+#include "exec/exec-all.h"
 
 #define float64_snan_to_qnan(x) ((x) | 0x0008000000000000ULL)
 #define float32_snan_to_qnan(x) ((x) | 0x00400000)
@@ -200,8 +201,9 @@  static inline uint64_t float_invalid_op_excp(CPUPPCState *env, int op,
         /* Update the floating-point enabled exception summary */
         env->fpscr |= 1 << FPSCR_FEX;
         if (msr_fe0 != 0 || msr_fe1 != 0) {
-            helper_raise_exception_err(env, POWERPC_EXCP_PROGRAM,
-                                       POWERPC_EXCP_FP | op);
+            /* GETPC() works here because this is inline */
+            raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM,
+                                   POWERPC_EXCP_FP | op, GETPC());
         }
     }
     return ret;