Re: [Qemu-devel] [PATCH 09/32] ppc: Make float_invalid_op_excp() pass the return address

2016-07-28 Thread Benjamin Herrenschmidt
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.



Re: [Qemu-devel] [PATCH 09/32] ppc: Make float_invalid_op_excp() pass the return address

2016-07-28 Thread Benjamin Herrenschmidt
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.



Re: [Qemu-devel] [PATCH 09/32] ppc: Make float_invalid_op_excp() pass the return address

2016-07-28 Thread Richard Henderson

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~



[Qemu-devel] [PATCH 09/32] ppc: Make float_invalid_op_excp() pass the return address

2016-07-26 Thread Benjamin Herrenschmidt
Instead of relying on NIP having been updated already

Signed-off-by: Benjamin Herrenschmidt 
---
 target-ppc/fpu_helper.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

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) | 0x0008ULL)
 #define float32_snan_to_qnan(x) ((x) | 0x0040)
@@ -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;
-- 
2.7.4