Go to the documentation of this file.
9 #ifndef __ASM_ARM_OPCODES_H
10 #define __ASM_ARM_OPCODES_H
16 #define ARM_OPCODE_CONDTEST_FAIL 0
17 #define ARM_OPCODE_CONDTEST_PASS 1
18 #define ARM_OPCODE_CONDTEST_UNCOND 2
26 #define ___asm_opcode_swab32(x) ( \
27 (((x) << 24) & 0xFF000000) \
28 | (((x) << 8) & 0x00FF0000) \
29 | (((x) >> 8) & 0x0000FF00) \
30 | (((x) >> 24) & 0x000000FF) \
32 #define ___asm_opcode_swab16(x) ( \
33 (((x) << 8) & 0xFF00) \
34 | (((x) >> 8) & 0x00FF) \
36 #define ___asm_opcode_swahb32(x) ( \
37 (((x) << 8) & 0xFF00FF00) \
38 | (((x) >> 8) & 0x00FF00FF) \
40 #define ___asm_opcode_swahw32(x) ( \
41 (((x) << 16) & 0xFFFF0000) \
42 | (((x) >> 16) & 0x0000FFFF) \
44 #define ___asm_opcode_identity32(x) ((x) & 0xFFFFFFFF)
45 #define ___asm_opcode_identity16(x) ((x) & 0xFFFF)
78 #define ___opcode_swab32(x) ___asm_opcode_swab32(x)
79 #define ___opcode_swab16(x) ___asm_opcode_swab16(x)
80 #define ___opcode_swahb32(x) ___asm_opcode_swahb32(x)
81 #define ___opcode_swahw32(x) ___asm_opcode_swahw32(x)
82 #define ___opcode_identity32(x) ___asm_opcode_identity32(x)
83 #define ___opcode_identity16(x) ___asm_opcode_identity16(x)
87 #include <linux/types.h>
88 #include <linux/swab.h>
90 #define ___opcode_swab32(x) swab32(x)
91 #define ___opcode_swab16(x) swab16(x)
92 #define ___opcode_swahb32(x) swahb32(x)
93 #define ___opcode_swahw32(x) swahw32(x)
94 #define ___opcode_identity32(x) ((u32)(x))
95 #define ___opcode_identity16(x) ((u16)(x))
100 #ifdef CONFIG_CPU_ENDIAN_BE8
102 #define __opcode_to_mem_arm(x) ___opcode_swab32(x)
103 #define __opcode_to_mem_thumb16(x) ___opcode_swab16(x)
104 #define __opcode_to_mem_thumb32(x) ___opcode_swahb32(x)
105 #define ___asm_opcode_to_mem_arm(x) ___asm_opcode_swab32(x)
106 #define ___asm_opcode_to_mem_thumb16(x) ___asm_opcode_swab16(x)
107 #define ___asm_opcode_to_mem_thumb32(x) ___asm_opcode_swahb32(x)
111 #define __opcode_to_mem_arm(x) ___opcode_identity32(x)
112 #define __opcode_to_mem_thumb16(x) ___opcode_identity16(x)
113 #define ___asm_opcode_to_mem_arm(x) ___asm_opcode_identity32(x)
114 #define ___asm_opcode_to_mem_thumb16(x) ___asm_opcode_identity16(x)
115 #ifndef CONFIG_CPU_ENDIAN_BE32
121 #define __opcode_to_mem_thumb32(x) ___opcode_swahw32(x)
122 #define ___asm_opcode_to_mem_thumb32(x) ___asm_opcode_swahw32(x)
127 #define __mem_to_opcode_arm(x) __opcode_to_mem_arm(x)
128 #define __mem_to_opcode_thumb16(x) __opcode_to_mem_thumb16(x)
129 #ifndef CONFIG_CPU_ENDIAN_BE32
130 #define __mem_to_opcode_thumb32(x) __opcode_to_mem_thumb32(x)
136 #define __opcode_is_thumb32(x) ( \
137 ((x) & 0xF8000000) == 0xE8000000 \
138 || ((x) & 0xF0000000) == 0xF0000000 \
140 #define __opcode_is_thumb16(x) ( \
141 ((x) & 0xFFFF0000) == 0 \
142 && !(((x) & 0xF800) == 0xE800 || ((x) & 0xF000) == 0xF000) \
146 #define __opcode_thumb32_first(x) (___opcode_identity16((x) >> 16))
147 #define __opcode_thumb32_second(x) (___opcode_identity16(x))
148 #define __opcode_thumb32_compose(first, second) ( \
149 (___opcode_identity32(___opcode_identity16(first)) << 16) \
150 | ___opcode_identity32(___opcode_identity16(second)) \
152 #define ___asm_opcode_thumb32_first(x) (___asm_opcode_identity16((x) >> 16))
153 #define ___asm_opcode_thumb32_second(x) (___asm_opcode_identity16(x))
154 #define ___asm_opcode_thumb32_compose(first, second) ( \
155 (___asm_opcode_identity32(___asm_opcode_identity16(first)) << 16) \
156 | ___asm_opcode_identity32(___asm_opcode_identity16(second)) \
201 #define __inst_arm(x) ___inst_arm(___asm_opcode_to_mem_arm(x))
202 #define __inst_thumb32(x) ___inst_thumb32( \
203 ___asm_opcode_to_mem_thumb16(___asm_opcode_thumb32_first(x)), \
204 ___asm_opcode_to_mem_thumb16(___asm_opcode_thumb32_second(x)) \
206 #define __inst_thumb16(x) ___inst_thumb16(___asm_opcode_to_mem_thumb16(x))
208 #ifdef CONFIG_THUMB2_KERNEL
209 #define __inst_arm_thumb16(arm_opcode, thumb_opcode) \
210 __inst_thumb16(thumb_opcode)
211 #define __inst_arm_thumb32(arm_opcode, thumb_opcode) \
212 __inst_thumb32(thumb_opcode)
214 #define __inst_arm_thumb16(arm_opcode, thumb_opcode) __inst_arm(arm_opcode)
215 #define __inst_arm_thumb32(arm_opcode, thumb_opcode) __inst_arm(arm_opcode)
220 #define ___inst_arm(x) .long x
221 #define ___inst_thumb16(x) .short x
222 #define ___inst_thumb32(first, second) .short first, second
224 #define ___inst_arm(x) ".long " __stringify(x) "\n\t"
225 #define ___inst_thumb16(x) ".short " __stringify(x) "\n\t"
226 #define ___inst_thumb32(first, second) \
227 ".short " __stringify(first) ", " __stringify(second) "\n\t"