[PATCH v2 23/85] target/arm: Expand syndrome parameter to raise_exception*

Richard Henderson posted 85 patches 3 months, 2 weeks ago
There is a newer version of this series
[PATCH v2 23/85] target/arm: Expand syndrome parameter to raise_exception*
Posted by Richard Henderson 3 months, 2 weeks ago
Prepare for raising exceptions with 64-bit syndromes.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/internals.h     | 6 +++---
 target/arm/tcg-stubs.c     | 2 +-
 target/arm/tcg/op_helper.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/target/arm/internals.h b/target/arm/internals.h
index f0e888ff93..fc82dd65e8 100644
--- a/target/arm/internals.h
+++ b/target/arm/internals.h
@@ -306,14 +306,14 @@ FIELD(CNTHCTL, CNTPMASK, 19, 1)
  * and never returns because we will longjump back up to the CPU main loop.
  */
 G_NORETURN void raise_exception(CPUARMState *env, uint32_t excp,
-                                uint32_t syndrome, uint32_t target_el);
+                                uint64_t syndrome, uint32_t target_el);
 
 /*
  * Similarly, but also use unwinding to restore cpu state.
  */
 G_NORETURN void raise_exception_ra(CPUARMState *env, uint32_t excp,
-                                      uint32_t syndrome, uint32_t target_el,
-                                      uintptr_t ra);
+                                   uint64_t syndrome, uint32_t target_el,
+                                   uintptr_t ra);
 
 /*
  * For AArch64, map a given EL to an index in the banked_spsr array.
diff --git a/target/arm/tcg-stubs.c b/target/arm/tcg-stubs.c
index aac99b2672..aeeede8066 100644
--- a/target/arm/tcg-stubs.c
+++ b/target/arm/tcg-stubs.c
@@ -16,7 +16,7 @@ void write_v7m_exception(CPUARMState *env, uint32_t new_exc)
     g_assert_not_reached();
 }
 
-void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome,
+void raise_exception_ra(CPUARMState *env, uint32_t excp, uint64_t syndrome,
                         uint32_t target_el, uintptr_t ra)
 {
     g_assert_not_reached();
diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c
index 575e566280..46a3b911ec 100644
--- a/target/arm/tcg/op_helper.c
+++ b/target/arm/tcg/op_helper.c
@@ -46,7 +46,7 @@ int exception_target_el(CPUARMState *env)
 }
 
 void raise_exception(CPUARMState *env, uint32_t excp,
-                     uint32_t syndrome, uint32_t target_el)
+                     uint64_t syndrome, uint32_t target_el)
 {
     CPUState *cs = env_cpu(env);
 
@@ -70,7 +70,7 @@ void raise_exception(CPUARMState *env, uint32_t excp,
     cpu_loop_exit(cs);
 }
 
-void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome,
+void raise_exception_ra(CPUARMState *env, uint32_t excp, uint64_t syndrome,
                         uint32_t target_el, uintptr_t ra)
 {
     CPUState *cs = env_cpu(env);
-- 
2.43.0
Re: [PATCH v2 23/85] target/arm: Expand syndrome parameter to raise_exception*
Posted by Philippe Mathieu-Daudé 3 months ago
On 3/8/25 01:28, Richard Henderson wrote:
> Prepare for raising exceptions with 64-bit syndromes.
> 
> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/internals.h     | 6 +++---
>   target/arm/tcg-stubs.c     | 2 +-
>   target/arm/tcg/op_helper.c | 4 ++--
>   3 files changed, 6 insertions(+), 6 deletions(-)

Maybe re-order with previous patch?

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


Re: [PATCH v2 23/85] target/arm: Expand syndrome parameter to raise_exception*
Posted by Richard Henderson 3 months ago
On 8/12/25 16:26, Philippe Mathieu-Daudé wrote:
> On 3/8/25 01:28, Richard Henderson wrote:
>> Prepare for raising exceptions with 64-bit syndromes.
>>
>> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>>   target/arm/internals.h     | 6 +++---
>>   target/arm/tcg-stubs.c     | 2 +-
>>   target/arm/tcg/op_helper.c | 4 ++--
>>   3 files changed, 6 insertions(+), 6 deletions(-)
> 
> Maybe re-order with previous patch?

No.  With this order, the destination is never smaller than the source.

(1) Widen env->exception.syndrome
(2) Widen raise_exception syndrome
(3) Generate a 64-bit syndrome during translate.


r~

Re: [PATCH v2 23/85] target/arm: Expand syndrome parameter to raise_exception*
Posted by Philippe Mathieu-Daudé 3 months ago
On 12/8/25 14:15, Richard Henderson wrote:
> On 8/12/25 16:26, Philippe Mathieu-Daudé wrote:
>> On 3/8/25 01:28, Richard Henderson wrote:
>>> Prepare for raising exceptions with 64-bit syndromes.
>>>
>>> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>>> ---
>>>   target/arm/internals.h     | 6 +++---
>>>   target/arm/tcg-stubs.c     | 2 +-
>>>   target/arm/tcg/op_helper.c | 4 ++--
>>>   3 files changed, 6 insertions(+), 6 deletions(-)
>>
>> Maybe re-order with previous patch?
> 
> No.  With this order, the destination is never smaller than the source.
> 
> (1) Widen env->exception.syndrome
> (2) Widen raise_exception syndrome
> (3) Generate a 64-bit syndrome during translate.

Right. I was reading the series backwards 🤦