target/arm/tcg/arm_ldst.h: merge in translate.c
Only translate.c uses those functions, thus move them back to this file. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20260407222208.271838-18-pierrick.bouvier@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Pierrick Bouvier committed
Apr 23, 2026 at 10:24 UTC
1481fe970f66306e12e7d662f88610c454471075
2 files changed
+23
-48
target/arm/tcg/arm_ldst.h
-47
@@ -1,47 +0,0 @@
1
-/*
2
- * ARM load/store instructions for code (armeb-user support)
3
- *
4
- * Copyright (c) 2012 CodeSourcery, LLC
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License, or (at your option) any later version.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18
- */
19
-
20
-#ifndef ARM_LDST_H
21
-#define ARM_LDST_H
22
-
23
-#include "exec/translator.h"
24
-#include "qemu/bswap.h"
25
-
26
-/* Load an instruction and return it in the standard little-endian order */
27
-static inline uint32_t arm_ldl_code(CPUARMState *env, DisasContextBase *s,
28
- target_ulong addr, bool sctlr_b)
29
-{
30
- return translator_ldl_swap(env, s, addr, bswap_code(sctlr_b));
31
-}
32
-
33
-/* Ditto, for a halfword (Thumb) instruction */
34
-static inline uint16_t arm_lduw_code(CPUARMState *env, DisasContextBase* s,
35
- target_ulong addr, bool sctlr_b)
36
-{
37
-#ifndef CONFIG_USER_ONLY
38
- /* In big-endian (BE32) mode, adjacent Thumb instructions have been swapped
39
- within each word. Undo that now. */
40
- if (sctlr_b) {
41
- addr ^= 2;
42
- }
43
-#endif
44
- return translator_lduw_swap(env, s, addr, bswap_code(sctlr_b));
45
-}
46
-
47
-#endif
target/arm/tcg/translate.c
+23
-1
@@ -25,7 +25,6 @@
25
#define TCG_ADDRESS_BITS 32
26
#include "tcg/tcg-op-mem.h"
27
#include "qemu/log.h"
28
-#include "arm_ldst.h"
28
#include "semihosting/semihost.h"
29
#include "cpregs.h"
30
#include "exec/target_page.h"
@@ -6281,6 +6280,22 @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn)
6280
}
6281
}
6282
6283
+/* Ditto, for a halfword (Thumb) instruction */
6284
+static uint16_t arm_lduw_code(CPUARMState *env, DisasContextBase* s,
6285
+ target_ulong addr, bool sctlr_b)
6286
+{
6287
+#ifndef CONFIG_USER_ONLY
6288
+ /*
6289
+ * In big-endian (BE32) mode, adjacent Thumb instructions have been swapped
6290
+ * within each word. Undo that now.
6291
+ */
6292
+ if (sctlr_b) {
6293
+ addr ^= 2;
6294
+ }
6295
+#endif
6296
+ return translator_lduw_swap(env, s, addr, bswap_code(sctlr_b));
6297
+}
6298
+
6299
static bool insn_crosses_page(CPUARMState *env, DisasContext *s)
6300
{
6301
/* Return true if the insn at dc->base.pc_next might cross a page boundary.
@@ -6515,6 +6530,13 @@ static void arm_post_translate_insn(DisasContext *dc)
6530
}
6531
}
6532
6533
+/* Load an instruction and return it in the standard little-endian order */
6534
+static uint32_t arm_ldl_code(CPUARMState *env, DisasContextBase *s,
6535
+ target_ulong addr, bool sctlr_b)
6536
+{
6537
+ return translator_ldl_swap(env, s, addr, bswap_code(sctlr_b));
6538
+}
6539
+
6540
static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
6541
{
6542
DisasContext *dc = container_of(dcbase, DisasContext, base);