]>
Commit | Line | Data |
---|---|---|
1d854765 PB |
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 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 | ||
ae82adc8 | 23 | #include "exec/translator.h" |
1d854765 PB |
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, target_ulong addr, | |
f9fd40eb | 28 | bool sctlr_b) |
1d854765 | 29 | { |
ae82adc8 | 30 | return translator_ldl_swap(env, addr, bswap_code(sctlr_b)); |
1d854765 PB |
31 | } |
32 | ||
33 | /* Ditto, for a halfword (Thumb) instruction */ | |
34 | static inline uint16_t arm_lduw_code(CPUARMState *env, target_ulong addr, | |
f9fd40eb | 35 | bool sctlr_b) |
1d854765 | 36 | { |
f7478a92 JB |
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 | |
ae82adc8 | 44 | return translator_lduw_swap(env, addr, bswap_code(sctlr_b)); |
1d854765 PB |
45 | } |
46 | ||
47 | #endif |