diff options
author | Leif Lindholm <leif.lindholm@arm.com> | 2011-12-12 13:44:49 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-12-13 03:52:02 -0500 |
commit | e7f626db83689f55089717a6d771c57afe1adc1a (patch) | |
tree | 29d15e9f913ffefdf16bc88c8f220e7ba9cc7548 /arch/arm/nwfpe | |
parent | 0c9030deaf59d444f9e757ee73d6d81bfe2d3376 (diff) |
ARM: 7207/1: Use generic ARM instruction set condition code checks for nwfpe.
This patch changes the nwfpe implementation to use the new generic
ARM instruction set condition code checks, rather than a local
implementation. It also removes the existing condition code checking,
which has been used for the generic support (in kernel/opcodes.{ch}).
This code has not been tested beyond building, linking and booting.
Signed-off-by: Leif Lindholm <leif.lindholm@arm.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/nwfpe')
-rw-r--r-- | arch/arm/nwfpe/entry.S | 8 | ||||
-rw-r--r-- | arch/arm/nwfpe/fpopcode.c | 26 | ||||
-rw-r--r-- | arch/arm/nwfpe/fpopcode.h | 3 |
3 files changed, 5 insertions, 32 deletions
diff --git a/arch/arm/nwfpe/entry.S b/arch/arm/nwfpe/entry.S index cafa18354339..d18dde95b8aa 100644 --- a/arch/arm/nwfpe/entry.S +++ b/arch/arm/nwfpe/entry.S | |||
@@ -20,6 +20,8 @@ | |||
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <asm/opcodes.h> | ||
24 | |||
23 | /* This is the kernel's entry point into the floating point emulator. | 25 | /* This is the kernel's entry point into the floating point emulator. |
24 | It is called from the kernel with code similar to this: | 26 | It is called from the kernel with code similar to this: |
25 | 27 | ||
@@ -81,11 +83,11 @@ nwfpe_enter: | |||
81 | mov r6, r0 @ save the opcode | 83 | mov r6, r0 @ save the opcode |
82 | emulate: | 84 | emulate: |
83 | ldr r1, [sp, #S_PSR] @ fetch the PSR | 85 | ldr r1, [sp, #S_PSR] @ fetch the PSR |
84 | bl checkCondition @ check the condition | 86 | bl arm_check_condition @ check the condition |
85 | cmp r0, #0 @ r0 = 0 ==> condition failed | 87 | cmp r0, #ARM_OPCODE_CONDTEST_PASS @ condition passed? |
86 | 88 | ||
87 | @ if condition code failed to match, next insn | 89 | @ if condition code failed to match, next insn |
88 | beq next @ get the next instruction; | 90 | bne next @ get the next instruction; |
89 | 91 | ||
90 | mov r0, r6 @ prepare for EmulateAll() | 92 | mov r0, r6 @ prepare for EmulateAll() |
91 | bl EmulateAll @ emulate the instruction | 93 | bl EmulateAll @ emulate the instruction |
diff --git a/arch/arm/nwfpe/fpopcode.c b/arch/arm/nwfpe/fpopcode.c index 922b81107585..ff9834673085 100644 --- a/arch/arm/nwfpe/fpopcode.c +++ b/arch/arm/nwfpe/fpopcode.c | |||
@@ -61,29 +61,3 @@ const float32 float32Constant[] = { | |||
61 | 0x41200000 /* single 10.0 */ | 61 | 0x41200000 /* single 10.0 */ |
62 | }; | 62 | }; |
63 | 63 | ||
64 | /* condition code lookup table | ||
65 | index into the table is test code: EQ, NE, ... LT, GT, AL, NV | ||
66 | bit position in short is condition code: NZCV */ | ||
67 | static const unsigned short aCC[16] = { | ||
68 | 0xF0F0, // EQ == Z set | ||
69 | 0x0F0F, // NE | ||
70 | 0xCCCC, // CS == C set | ||
71 | 0x3333, // CC | ||
72 | 0xFF00, // MI == N set | ||
73 | 0x00FF, // PL | ||
74 | 0xAAAA, // VS == V set | ||
75 | 0x5555, // VC | ||
76 | 0x0C0C, // HI == C set && Z clear | ||
77 | 0xF3F3, // LS == C clear || Z set | ||
78 | 0xAA55, // GE == (N==V) | ||
79 | 0x55AA, // LT == (N!=V) | ||
80 | 0x0A05, // GT == (!Z && (N==V)) | ||
81 | 0xF5FA, // LE == (Z || (N!=V)) | ||
82 | 0xFFFF, // AL always | ||
83 | 0 // NV | ||
84 | }; | ||
85 | |||
86 | unsigned int checkCondition(const unsigned int opcode, const unsigned int ccodes) | ||
87 | { | ||
88 | return (aCC[opcode >> 28] >> (ccodes >> 28)) & 1; | ||
89 | } | ||
diff --git a/arch/arm/nwfpe/fpopcode.h b/arch/arm/nwfpe/fpopcode.h index 786e4c96156d..78f02dbfaa8f 100644 --- a/arch/arm/nwfpe/fpopcode.h +++ b/arch/arm/nwfpe/fpopcode.h | |||
@@ -475,9 +475,6 @@ static inline unsigned int getDestinationSize(const unsigned int opcode) | |||
475 | return (nRc); | 475 | return (nRc); |
476 | } | 476 | } |
477 | 477 | ||
478 | extern unsigned int checkCondition(const unsigned int opcode, | ||
479 | const unsigned int ccodes); | ||
480 | |||
481 | extern const float64 float64Constant[]; | 478 | extern const float64 float64Constant[]; |
482 | extern const float32 float32Constant[]; | 479 | extern const float32 float32Constant[]; |
483 | 480 | ||