Nicholas Flintham | 1e3d311 | 2013-04-10 10:48:38 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * arch/arm/include/asm/opcodes.h |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | */ |
| 8 | |
| 9 | #ifndef __ASM_ARM_OPCODES_H |
| 10 | #define __ASM_ARM_OPCODES_H |
| 11 | |
| 12 | #ifndef __ASSEMBLY__ |
| 13 | extern asmlinkage unsigned int arm_check_condition(u32 opcode, u32 psr); |
| 14 | #endif |
| 15 | |
| 16 | #define ARM_OPCODE_CONDTEST_FAIL 0 |
| 17 | #define ARM_OPCODE_CONDTEST_PASS 1 |
| 18 | #define ARM_OPCODE_CONDTEST_UNCOND 2 |
| 19 | |
| 20 | |
| 21 | |
| 22 | #ifndef __ASSEMBLY__ |
| 23 | |
| 24 | #include <linux/types.h> |
| 25 | #include <linux/swab.h> |
| 26 | |
| 27 | #ifdef CONFIG_CPU_ENDIAN_BE8 |
| 28 | #define __opcode_to_mem_arm(x) swab32(x) |
| 29 | #define __opcode_to_mem_thumb16(x) swab16(x) |
| 30 | #define __opcode_to_mem_thumb32(x) swahb32(x) |
| 31 | #else |
| 32 | #define __opcode_to_mem_arm(x) ((u32)(x)) |
| 33 | #define __opcode_to_mem_thumb16(x) ((u16)(x)) |
| 34 | #define __opcode_to_mem_thumb32(x) swahw32(x) |
| 35 | #endif |
| 36 | |
| 37 | #define __mem_to_opcode_arm(x) __opcode_to_mem_arm(x) |
| 38 | #define __mem_to_opcode_thumb16(x) __opcode_to_mem_thumb16(x) |
| 39 | #define __mem_to_opcode_thumb32(x) __opcode_to_mem_thumb32(x) |
| 40 | |
| 41 | |
| 42 | #define __opcode_is_thumb32(x) ((u32)(x) >= 0xE8000000UL) |
| 43 | #define __opcode_is_thumb16(x) ((u32)(x) < 0xE800UL) |
| 44 | |
| 45 | #define __opcode_thumb32_first(x) ((u16)((x) >> 16)) |
| 46 | #define __opcode_thumb32_second(x) ((u16)(x)) |
| 47 | #define __opcode_thumb32_compose(first, second) \ |
| 48 | (((u32)(u16)(first) << 16) | (u32)(u16)(second)) |
| 49 | |
| 50 | #endif |
| 51 | |
| 52 | #endif |