[PATCH v3 19/25] system: Allow restricting the legacy translator_ld() 'native-endian' API

Philippe Mathieu-Daudé posted 25 patches 1 month, 2 weeks ago
There is a newer version of this series
[PATCH v3 19/25] system: Allow restricting the legacy translator_ld() 'native-endian' API
Posted by Philippe Mathieu-Daudé 1 month, 2 weeks ago
Guard the native endian APIs we want to remove by surrounding
them with TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API #ifdef'ry.

Once a target gets cleaned we'll set the definition in the
target config, then the target won't be able to use the legacy
API anymore.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/exec/translator.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/exec/translator.h b/include/exec/translator.h
index 3c326555696..8d343627bd9 100644
--- a/include/exec/translator.h
+++ b/include/exec/translator.h
@@ -188,7 +188,8 @@ uint32_t translator_ldl_end(CPUArchState *env, DisasContextBase *db,
 uint64_t translator_ldq_end(CPUArchState *env, DisasContextBase *db,
                             vaddr pc, MemOp endian);
 
-#ifdef COMPILING_PER_TARGET
+#if !defined(TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API) \
+    && defined(COMPILING_PER_TARGET)
 static inline uint16_t
 translator_lduw(CPUArchState *env, DisasContextBase *db, vaddr pc)
 {
@@ -227,7 +228,7 @@ translator_ldq_swap(CPUArchState *env, DisasContextBase *db,
 {
     return translator_ldq_end(env, db, pc, MO_TE ^ (do_swap * MO_BSWAP));
 }
-#endif /* COMPILING_PER_TARGET */
+#endif /* !TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API && COMPILING_PER_TARGET */
 
 /**
  * translator_fake_ld - fake instruction load
-- 
2.52.0


Re: [PATCH v3 19/25] system: Allow restricting the legacy translator_ld() 'native-endian' API
Posted by Richard Henderson 1 month, 1 week ago
On 12/25/25 02:22, Philippe Mathieu-Daudé wrote:
> Guard the native endian APIs we want to remove by surrounding
> them with TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API #ifdef'ry.
> 
> Once a target gets cleaned we'll set the definition in the
> target config, then the target won't be able to use the legacy
> API anymore.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/exec/translator.h | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/include/exec/translator.h b/include/exec/translator.h
> index 3c326555696..8d343627bd9 100644
> --- a/include/exec/translator.h
> +++ b/include/exec/translator.h
> @@ -188,7 +188,8 @@ uint32_t translator_ldl_end(CPUArchState *env, DisasContextBase *db,
>   uint64_t translator_ldq_end(CPUArchState *env, DisasContextBase *db,
>                               vaddr pc, MemOp endian);
>   
> -#ifdef COMPILING_PER_TARGET
> +#if !defined(TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API) \
> +    && defined(COMPILING_PER_TARGET)
>   static inline uint16_t
>   translator_lduw(CPUArchState *env, DisasContextBase *db, vaddr pc)
>   {
> @@ -227,7 +228,7 @@ translator_ldq_swap(CPUArchState *env, DisasContextBase *db,
>   {
>       return translator_ldq_end(env, db, pc, MO_TE ^ (do_swap * MO_BSWAP));
>   }
> -#endif /* COMPILING_PER_TARGET */
> +#endif /* !TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API && COMPILING_PER_TARGET */
>   
>   /**
>    * translator_fake_ld - fake instruction load

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

r~