diff mbox series

[RFC,05/34] target/tricore: [VADDR] Use target_ulong for EA

Message ID 20240119144024.14289-6-anjo@rev.ng (mailing list archive)
State New, archived
Headers show
Series Compile accel/tcg once (partially) | expand

Commit Message

Anton Johansson Jan. 19, 2024, 2:39 p.m. UTC
Prepares target for typedef'ing abi_ptr to vaddr.  Fixes sign extension
bug that would result from abi_ptr being unsigned in the future.

Necessary to make memory access function signatures target agnostic.

Signed-off-by: Anton Johansson <anjo@rev.ng>
---
 target/tricore/op_helper.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Richard Henderson Jan. 23, 2024, 10:29 p.m. UTC | #1
On 1/20/24 00:39, Anton Johansson wrote:
> Prepares target for typedef'ing abi_ptr to vaddr.  Fixes sign extension
> bug that would result from abi_ptr being unsigned in the future.
> 
> Necessary to make memory access function signatures target agnostic.
> 
> Signed-off-by: Anton Johansson<anjo@rev.ng>
> ---
>   target/tricore/op_helper.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
Richard Henderson Jan. 27, 2024, 8:26 a.m. UTC | #2
On 1/20/24 00:39, Anton Johansson wrote:
> Prepares target for typedef'ing abi_ptr to vaddr.  Fixes sign extension
> bug that would result from abi_ptr being unsigned in the future.
> 
> Necessary to make memory access function signatures target agnostic.
> 
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> ---
>   target/tricore/op_helper.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)

This has been fixed on master since

commit ceada000846b0cd81c578b1da9f76d0c59536654
Author: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Date:   Wed Sep 13 12:53:26 2023 +0200

     target/tricore: Change effective address (ea) to target_ulong

I'm confused about the branch on which you're working...


r~

> 
> diff --git a/target/tricore/op_helper.c b/target/tricore/op_helper.c
> index 89be1ed648..f57bb39d1f 100644
> --- a/target/tricore/op_helper.c
> +++ b/target/tricore/op_helper.c
> @@ -2395,7 +2395,7 @@ static bool cdc_zero(target_ulong *psw)
>       return count == 0;
>   }
>   
> -static void save_context_upper(CPUTriCoreState *env, int ea)
> +static void save_context_upper(CPUTriCoreState *env, target_ulong ea)
>   {
>       cpu_stl_data(env, ea, env->PCXI);
>       cpu_stl_data(env, ea+4, psw_read(env));
> @@ -2415,7 +2415,7 @@ static void save_context_upper(CPUTriCoreState *env, int ea)
>       cpu_stl_data(env, ea+60, env->gpr_d[15]);
>   }
>   
> -static void save_context_lower(CPUTriCoreState *env, int ea)
> +static void save_context_lower(CPUTriCoreState *env, target_ulong ea)
>   {
>       cpu_stl_data(env, ea, env->PCXI);
>       cpu_stl_data(env, ea+4, env->gpr_a[11]);
> @@ -2435,7 +2435,7 @@ static void save_context_lower(CPUTriCoreState *env, int ea)
>       cpu_stl_data(env, ea+60, env->gpr_d[7]);
>   }
>   
> -static void restore_context_upper(CPUTriCoreState *env, int ea,
> +static void restore_context_upper(CPUTriCoreState *env, target_ulong ea,
>                                     target_ulong *new_PCXI, target_ulong *new_PSW)
>   {
>       *new_PCXI = cpu_ldl_data(env, ea);
> @@ -2456,7 +2456,7 @@ static void restore_context_upper(CPUTriCoreState *env, int ea,
>       env->gpr_d[15] = cpu_ldl_data(env, ea+60);
>   }
>   
> -static void restore_context_lower(CPUTriCoreState *env, int ea,
> +static void restore_context_lower(CPUTriCoreState *env, target_ulong ea,
>                                     target_ulong *ra, target_ulong *pcxi)
>   {
>       *pcxi = cpu_ldl_data(env, ea);
diff mbox series

Patch

diff --git a/target/tricore/op_helper.c b/target/tricore/op_helper.c
index 89be1ed648..f57bb39d1f 100644
--- a/target/tricore/op_helper.c
+++ b/target/tricore/op_helper.c
@@ -2395,7 +2395,7 @@  static bool cdc_zero(target_ulong *psw)
     return count == 0;
 }
 
-static void save_context_upper(CPUTriCoreState *env, int ea)
+static void save_context_upper(CPUTriCoreState *env, target_ulong ea)
 {
     cpu_stl_data(env, ea, env->PCXI);
     cpu_stl_data(env, ea+4, psw_read(env));
@@ -2415,7 +2415,7 @@  static void save_context_upper(CPUTriCoreState *env, int ea)
     cpu_stl_data(env, ea+60, env->gpr_d[15]);
 }
 
-static void save_context_lower(CPUTriCoreState *env, int ea)
+static void save_context_lower(CPUTriCoreState *env, target_ulong ea)
 {
     cpu_stl_data(env, ea, env->PCXI);
     cpu_stl_data(env, ea+4, env->gpr_a[11]);
@@ -2435,7 +2435,7 @@  static void save_context_lower(CPUTriCoreState *env, int ea)
     cpu_stl_data(env, ea+60, env->gpr_d[7]);
 }
 
-static void restore_context_upper(CPUTriCoreState *env, int ea,
+static void restore_context_upper(CPUTriCoreState *env, target_ulong ea,
                                   target_ulong *new_PCXI, target_ulong *new_PSW)
 {
     *new_PCXI = cpu_ldl_data(env, ea);
@@ -2456,7 +2456,7 @@  static void restore_context_upper(CPUTriCoreState *env, int ea,
     env->gpr_d[15] = cpu_ldl_data(env, ea+60);
 }
 
-static void restore_context_lower(CPUTriCoreState *env, int ea,
+static void restore_context_lower(CPUTriCoreState *env, target_ulong ea,
                                   target_ulong *ra, target_ulong *pcxi)
 {
     *pcxi = cpu_ldl_data(env, ea);