Lines Matching +full:x +full:-
1 /* SPDX-License-Identifier: GPL-2.0-only */
24 #define ___asm_opcode_swab32(x) ( \ argument
25 (((x) << 24) & 0xFF000000) \
26 | (((x) << 8) & 0x00FF0000) \
27 | (((x) >> 8) & 0x0000FF00) \
28 | (((x) >> 24) & 0x000000FF) \
30 #define ___asm_opcode_swab16(x) ( \ argument
31 (((x) << 8) & 0xFF00) \
32 | (((x) >> 8) & 0x00FF) \
34 #define ___asm_opcode_swahb32(x) ( \ argument
35 (((x) << 8) & 0xFF00FF00) \
36 | (((x) >> 8) & 0x00FF00FF) \
38 #define ___asm_opcode_swahw32(x) ( \ argument
39 (((x) << 16) & 0xFFFF0000) \
40 | (((x) >> 16) & 0x0000FFFF) \
42 #define ___asm_opcode_identity32(x) ((x) & 0xFFFFFFFF) argument
43 #define ___asm_opcode_identity16(x) ((x) & 0xFFFF) argument
50 * format and in-memory representation, in an endianness-agnostic manner.
52 * __mem_to_opcode_*() convert from in-memory representation to canonical form.
53 * __opcode_to_mem_*() convert from canonical form to in-memory representation.
59 * Thumb 16-bit: 0x0000KKLL, where KK < 0xE8
60 * Thumb 32-bit: 0xKKLLMMNN, where KK >= 0xE8
67 * represent any valid Thumb-2 instruction. For this range,
76 #define ___opcode_swab32(x) ___asm_opcode_swab32(x)
77 #define ___opcode_swab16(x) ___asm_opcode_swab16(x)
78 #define ___opcode_swahb32(x) ___asm_opcode_swahb32(x)
79 #define ___opcode_swahw32(x) ___asm_opcode_swahw32(x)
80 #define ___opcode_identity32(x) ___asm_opcode_identity32(x)
81 #define ___opcode_identity16(x) ___asm_opcode_identity16(x)
88 #define ___opcode_swab32(x) swab32(x) argument
89 #define ___opcode_swab16(x) swab16(x) argument
90 #define ___opcode_swahb32(x) swahb32(x) argument
91 #define ___opcode_swahw32(x) swahw32(x) argument
92 #define ___opcode_identity32(x) ((u32)(x)) argument
93 #define ___opcode_identity16(x) ((u16)(x)) argument
100 #define __opcode_to_mem_arm(x) ___opcode_swab32(x) argument
101 #define __opcode_to_mem_thumb16(x) ___opcode_swab16(x) argument
102 #define __opcode_to_mem_thumb32(x) ___opcode_swahb32(x) argument
103 #define ___asm_opcode_to_mem_arm(x) ___asm_opcode_swab32(x) argument
104 #define ___asm_opcode_to_mem_thumb16(x) ___asm_opcode_swab16(x) argument
105 #define ___asm_opcode_to_mem_thumb32(x) ___asm_opcode_swahb32(x) argument
109 #define __opcode_to_mem_arm(x) ___opcode_identity32(x) argument
110 #define __opcode_to_mem_thumb16(x) ___opcode_identity16(x) argument
111 #define ___asm_opcode_to_mem_arm(x) ___asm_opcode_identity32(x) argument
112 #define ___asm_opcode_to_mem_thumb16(x) ___asm_opcode_identity16(x) argument
116 * On BE32 systems, using 32-bit accesses to store Thumb instructions will not
124 #define __opcode_to_mem_thumb32(x) ___opcode_swahw32(x) argument
125 #define ___asm_opcode_to_mem_thumb32(x) ___asm_opcode_swahw32(x) argument
130 #define __mem_to_opcode_arm(x) __opcode_to_mem_arm(x) argument
131 #define __mem_to_opcode_thumb16(x) __opcode_to_mem_thumb16(x) argument
133 #define __mem_to_opcode_thumb32(x) __opcode_to_mem_thumb32(x) argument
139 #define __opcode_is_thumb32(x) ( \ argument
140 ((x) & 0xF8000000) == 0xE8000000 \
141 || ((x) & 0xF0000000) == 0xF0000000 \
143 #define __opcode_is_thumb16(x) ( \ argument
144 ((x) & 0xFFFF0000) == 0 \
145 && !(((x) & 0xF800) == 0xE800 || ((x) & 0xF000) == 0xF000) \
148 /* Operations to construct or split 32-bit Thumb instructions: */
149 #define __opcode_thumb32_first(x) (___opcode_identity16((x) >> 16)) argument
150 #define __opcode_thumb32_second(x) (___opcode_identity16(x)) argument
155 #define ___asm_opcode_thumb32_first(x) (___asm_opcode_identity16((x) >> 16)) argument
156 #define ___asm_opcode_thumb32_second(x) (___asm_opcode_identity16(x)) argument
179 * __inst_arm(x): emit the specified ARM opcode
180 * __inst_thumb16(x): emit the specified 16-bit Thumb opcode
181 * __inst_thumb32(x): emit the specified 32-bit Thumb opcode
184 * 16-bit Thumb opcode, depending on whether an ARM or Thumb-2
188 * 32-bit Thumb opcode, depending on whether an ARM or Thumb-2
193 * should use them to define human-readable wrapper macros to encode the
200 * Look at opcodes-virt.h for an example of how to use these macros.
204 #define __inst_arm(x) ___inst_arm(___asm_opcode_to_mem_arm(x)) argument
205 #define __inst_thumb32(x) ___inst_thumb32( \ argument
206 ___asm_opcode_to_mem_thumb16(___asm_opcode_thumb32_first(x)), \
207 ___asm_opcode_to_mem_thumb16(___asm_opcode_thumb32_second(x)) \
209 #define __inst_thumb16(x) ___inst_thumb16(___asm_opcode_to_mem_thumb16(x)) argument
223 #define ___inst_arm(x) .long x
224 #define ___inst_thumb16(x) .short x
227 #define ___inst_arm(x) ".long " __stringify(x) "\n\t" argument
228 #define ___inst_thumb16(x) ".short " __stringify(x) "\n\t" argument