On 4/6/26 2:48 PM, Richard Henderson wrote:
> On 4/7/26 04:26, Pierrick Bouvier wrote:
>> Only translate.c uses those functions, thus move them back to this file.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>> target/arm/tcg/arm_ldst.h | 47 --------------------------------------
>> target/arm/tcg/translate.c | 22 +++++++++++++++++-
>> 2 files changed, 21 insertions(+), 48 deletions(-)
>
> You could drop the inline markers with the move.
>
Will do.
> Anyway,
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
>
> r~
>
>>
>> diff --git a/target/arm/tcg/arm_ldst.h b/target/arm/tcg/arm_ldst.h
>> index cee0548a1c7..e69de29bb2d 100644
>> --- a/target/arm/tcg/arm_ldst.h
>> +++ b/target/arm/tcg/arm_ldst.h
>> @@ -1,47 +0,0 @@
>> -/*
>> - * ARM load/store instructions for code (armeb-user support)
>> - *
>> - * Copyright (c) 2012 CodeSourcery, LLC
>> - *
>> - * This library is free software; you can redistribute it and/or
>> - * modify it under the terms of the GNU Lesser General Public
>> - * License as published by the Free Software Foundation; either
>> - * version 2.1 of the License, or (at your option) any later version.
>> - *
>> - * This library is distributed in the hope that it will be useful,
>> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> - * Lesser General Public License for more details.
>> - *
>> - * You should have received a copy of the GNU Lesser General Public
>> - * License along with this library; if not, see <http://www.gnu.org/licenses/>.
>> - */
>> -
>> -#ifndef ARM_LDST_H
>> -#define ARM_LDST_H
>> -
>> -#include "exec/translator.h"
>> -#include "qemu/bswap.h"
>> -
>> -/* Load an instruction and return it in the standard little-endian order */
>> -static inline uint32_t arm_ldl_code(CPUARMState *env, DisasContextBase *s,
>> - target_ulong addr, bool sctlr_b)
>> -{
>> - return translator_ldl_swap(env, s, addr, bswap_code(sctlr_b));
>> -}
>> -
>> -/* Ditto, for a halfword (Thumb) instruction */
>> -static inline uint16_t arm_lduw_code(CPUARMState *env, DisasContextBase* s,
>> - target_ulong addr, bool sctlr_b)
>> -{
>> -#ifndef CONFIG_USER_ONLY
>> - /* In big-endian (BE32) mode, adjacent Thumb instructions have been swapped
>> - within each word. Undo that now. */
>> - if (sctlr_b) {
>> - addr ^= 2;
>> - }
>> -#endif
>> - return translator_lduw_swap(env, s, addr, bswap_code(sctlr_b));
>> -}
>> -
>> -#endif
>> diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c
>> index 6ea48efbac2..7fcf0656630 100644
>> --- a/target/arm/tcg/translate.c
>> +++ b/target/arm/tcg/translate.c
>> @@ -25,7 +25,6 @@
>> #define TCG_ADDRESS_BITS 32
>> #include "tcg/tcg-op-mem.h"
>> #include "qemu/log.h"
>> -#include "arm_ldst.h"
>> #include "semihosting/semihost.h"
>> #include "cpregs.h"
>> #include "exec/target_page.h"
>> @@ -6280,6 +6279,20 @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn)
>> }
>> }
>>
>> +/* Ditto, for a halfword (Thumb) instruction */
>> +static inline uint16_t arm_lduw_code(CPUARMState *env, DisasContextBase* s,
>> + target_ulong addr, bool sctlr_b)
>> +{
>> +#ifndef CONFIG_USER_ONLY
>> + /* In big-endian (BE32) mode, adjacent Thumb instructions have been swapped
>> + within each word. Undo that now. */
>> + if (sctlr_b) {
>> + addr ^= 2;
>> + }
>> +#endif
>> + return translator_lduw_swap(env, s, addr, bswap_code(sctlr_b));
>> +}
>> +
>> static bool insn_crosses_page(CPUARMState *env, DisasContext *s)
>> {
>> /* Return true if the insn at dc->base.pc_next might cross a page boundary.
>> @@ -6514,6 +6527,13 @@ static void arm_post_translate_insn(DisasContext *dc)
>> }
>> }
>>
>> +/* Load an instruction and return it in the standard little-endian order */
>> +static inline uint32_t arm_ldl_code(CPUARMState *env, DisasContextBase *s,
>> + target_ulong addr, bool sctlr_b)
>> +{
>> + return translator_ldl_swap(env, s, addr, bswap_code(sctlr_b));
>> +}
>> +
>> static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
>> {
>> DisasContext *dc = container_of(dcbase, DisasContext, base);
>