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

Anton Johansson via posted 34 patches 10 months, 1 week ago
[RFC PATCH 05/34] target/tricore: [VADDR] Use target_ulong for EA
Posted by Anton Johansson via 10 months, 1 week ago
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(-)

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);
-- 
2.43.0
Re: [RFC PATCH 05/34] target/tricore: [VADDR] Use target_ulong for EA
Posted by Richard Henderson 10 months ago
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);
Re: [RFC PATCH 05/34] target/tricore: [VADDR] Use target_ulong for EA
Posted by Richard Henderson 10 months, 1 week ago
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~