Message ID | 20220627141104.669152-5-matheus.ferst@eldorado.org.br |
---|---|
State | New |
Headers | show |
Series | Fix gen_*_exception error codes | expand |
On 6/27/22 11:11, Matheus Ferst wrote: > POWERPC_EXCP_INVAL should only be or-ed with other constants prefixed > with POWERPC_EXCP_INVAL_. Also, take the opportunity to move both > helpers under #if !defined(CONFIG_USER_ONLY) as the instructions that > use them are privileged. > > No functional change is intended, the lower 4 bits of the error code are > ignored by all powerpc_excp_* methods on POWERPC_EXCP_INVAL exceptions. > > Reported-by: Laurent Vivier <laurent@vivier.eu> > Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br> > --- > target/ppc/helper.h | 2 +- > target/ppc/timebase_helper.c | 6 +++--- > 2 files changed, 4 insertions(+), 4 deletions(-) Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> > > diff --git a/target/ppc/helper.h b/target/ppc/helper.h > index 6233e28d85..c6895f2f99 100644 > --- a/target/ppc/helper.h > +++ b/target/ppc/helper.h > @@ -684,10 +684,10 @@ DEF_HELPER_2(book3s_msgclr, void, env, tl) > DEF_HELPER_4(dlmzb, tl, env, tl, tl, i32) > #if !defined(CONFIG_USER_ONLY) > DEF_HELPER_2(rac, tl, env, tl) > -#endif > > DEF_HELPER_2(load_dcr, tl, env, tl) > DEF_HELPER_3(store_dcr, void, env, tl, tl) > +#endif > > DEF_HELPER_2(load_dump_spr, void, env, i32) > DEF_HELPER_2(store_dump_spr, void, env, i32) > diff --git a/target/ppc/timebase_helper.c b/target/ppc/timebase_helper.c > index 86d01d6e4e..b80f56af7e 100644 > --- a/target/ppc/timebase_helper.c > +++ b/target/ppc/timebase_helper.c > @@ -143,7 +143,6 @@ void helper_store_booke_tsr(CPUPPCState *env, target_ulong val) > { > store_booke_tsr(env, val); > } > -#endif > > /*****************************************************************************/ > /* Embedded PowerPC specific helpers */ > @@ -169,7 +168,7 @@ target_ulong helper_load_dcr(CPUPPCState *env, target_ulong dcrn) > (uint32_t)dcrn, (uint32_t)dcrn); > raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM, > POWERPC_EXCP_INVAL | > - POWERPC_EXCP_PRIV_REG, GETPC()); > + POWERPC_EXCP_INVAL_INVAL, GETPC()); > } > } > return val; > @@ -192,7 +191,8 @@ void helper_store_dcr(CPUPPCState *env, target_ulong dcrn, target_ulong val) > (uint32_t)dcrn, (uint32_t)dcrn); > raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM, > POWERPC_EXCP_INVAL | > - POWERPC_EXCP_PRIV_REG, GETPC()); > + POWERPC_EXCP_INVAL_INVAL, GETPC()); > } > } > } > +#endif
diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 6233e28d85..c6895f2f99 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -684,10 +684,10 @@ DEF_HELPER_2(book3s_msgclr, void, env, tl) DEF_HELPER_4(dlmzb, tl, env, tl, tl, i32) #if !defined(CONFIG_USER_ONLY) DEF_HELPER_2(rac, tl, env, tl) -#endif DEF_HELPER_2(load_dcr, tl, env, tl) DEF_HELPER_3(store_dcr, void, env, tl, tl) +#endif DEF_HELPER_2(load_dump_spr, void, env, i32) DEF_HELPER_2(store_dump_spr, void, env, i32) diff --git a/target/ppc/timebase_helper.c b/target/ppc/timebase_helper.c index 86d01d6e4e..b80f56af7e 100644 --- a/target/ppc/timebase_helper.c +++ b/target/ppc/timebase_helper.c @@ -143,7 +143,6 @@ void helper_store_booke_tsr(CPUPPCState *env, target_ulong val) { store_booke_tsr(env, val); } -#endif /*****************************************************************************/ /* Embedded PowerPC specific helpers */ @@ -169,7 +168,7 @@ target_ulong helper_load_dcr(CPUPPCState *env, target_ulong dcrn) (uint32_t)dcrn, (uint32_t)dcrn); raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM, POWERPC_EXCP_INVAL | - POWERPC_EXCP_PRIV_REG, GETPC()); + POWERPC_EXCP_INVAL_INVAL, GETPC()); } } return val; @@ -192,7 +191,8 @@ void helper_store_dcr(CPUPPCState *env, target_ulong dcrn, target_ulong val) (uint32_t)dcrn, (uint32_t)dcrn); raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM, POWERPC_EXCP_INVAL | - POWERPC_EXCP_PRIV_REG, GETPC()); + POWERPC_EXCP_INVAL_INVAL, GETPC()); } } } +#endif
POWERPC_EXCP_INVAL should only be or-ed with other constants prefixed with POWERPC_EXCP_INVAL_. Also, take the opportunity to move both helpers under #if !defined(CONFIG_USER_ONLY) as the instructions that use them are privileged. No functional change is intended, the lower 4 bits of the error code are ignored by all powerpc_excp_* methods on POWERPC_EXCP_INVAL exceptions. Reported-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br> --- target/ppc/helper.h | 2 +- target/ppc/timebase_helper.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)