aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/nwfpe
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/arm/nwfpe
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'arch/arm/nwfpe')
-rw-r--r--arch/arm/nwfpe/entry.S8
-rw-r--r--arch/arm/nwfpe/fpa11.c1
-rw-r--r--arch/arm/nwfpe/fpmodule.c2
-rw-r--r--arch/arm/nwfpe/fpopcode.c26
-rw-r--r--arch/arm/nwfpe/fpopcode.h3
5 files changed, 34 insertions, 6 deletions
diff --git a/arch/arm/nwfpe/entry.S b/arch/arm/nwfpe/entry.S
index d18dde95b8a..cafa1835433 100644
--- a/arch/arm/nwfpe/entry.S
+++ b/arch/arm/nwfpe/entry.S
@@ -20,8 +20,6 @@
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
25/* This is the kernel's entry point into the floating point emulator. 23/* This is the kernel's entry point into the floating point emulator.
26It is called from the kernel with code similar to this: 24It is called from the kernel with code similar to this:
27 25
@@ -83,11 +81,11 @@ nwfpe_enter:
83 mov r6, r0 @ save the opcode 81 mov r6, r0 @ save the opcode
84emulate: 82emulate:
85 ldr r1, [sp, #S_PSR] @ fetch the PSR 83 ldr r1, [sp, #S_PSR] @ fetch the PSR
86 bl arm_check_condition @ check the condition 84 bl checkCondition @ check the condition
87 cmp r0, #ARM_OPCODE_CONDTEST_PASS @ condition passed? 85 cmp r0, #0 @ r0 = 0 ==> condition failed
88 86
89 @ if condition code failed to match, next insn 87 @ if condition code failed to match, next insn
90 bne next @ get the next instruction; 88 beq next @ get the next instruction;
91 89
92 mov r0, r6 @ prepare for EmulateAll() 90 mov r0, r6 @ prepare for EmulateAll()
93 bl EmulateAll @ emulate the instruction 91 bl EmulateAll @ emulate the instruction
diff --git a/arch/arm/nwfpe/fpa11.c b/arch/arm/nwfpe/fpa11.c
index 2782ebcc2ed..cc60acde84d 100644
--- a/arch/arm/nwfpe/fpa11.c
+++ b/arch/arm/nwfpe/fpa11.c
@@ -28,6 +28,7 @@
28 28
29#include <linux/compiler.h> 29#include <linux/compiler.h>
30#include <linux/string.h> 30#include <linux/string.h>
31#include <asm/system.h>
31 32
32/* Reset the FPA11 chip. Called to initialize and reset the emulator. */ 33/* Reset the FPA11 chip. Called to initialize and reset the emulator. */
33static void resetFPA11(void) 34static void resetFPA11(void)
diff --git a/arch/arm/nwfpe/fpmodule.c b/arch/arm/nwfpe/fpmodule.c
index 4e729f055a8..cb7658e8acc 100644
--- a/arch/arm/nwfpe/fpmodule.c
+++ b/arch/arm/nwfpe/fpmodule.c
@@ -147,7 +147,7 @@ void float_raise(signed char flags)
147#ifdef CONFIG_DEBUG_USER 147#ifdef CONFIG_DEBUG_USER
148 if (flags & debug) 148 if (flags & debug)
149 printk(KERN_DEBUG 149 printk(KERN_DEBUG
150 "NWFPE: %s[%d] takes exception %08x at %pf from %08lx\n", 150 "NWFPE: %s[%d] takes exception %08x at %p from %08lx\n",
151 current->comm, current->pid, flags, 151 current->comm, current->pid, flags,
152 __builtin_return_address(0), GET_USERREG()->ARM_pc); 152 __builtin_return_address(0), GET_USERREG()->ARM_pc);
153#endif 153#endif
diff --git a/arch/arm/nwfpe/fpopcode.c b/arch/arm/nwfpe/fpopcode.c
index ff983467308..922b8110758 100644
--- a/arch/arm/nwfpe/fpopcode.c
+++ b/arch/arm/nwfpe/fpopcode.c
@@ -61,3 +61,29 @@ 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 */
67static 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
86unsigned 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 78f02dbfaa8..786e4c96156 100644
--- a/arch/arm/nwfpe/fpopcode.h
+++ b/arch/arm/nwfpe/fpopcode.h
@@ -475,6 +475,9 @@ static inline unsigned int getDestinationSize(const unsigned int opcode)
475 return (nRc); 475 return (nRc);
476} 476}
477 477
478extern unsigned int checkCondition(const unsigned int opcode,
479 const unsigned int ccodes);
480
478extern const float64 float64Constant[]; 481extern const float64 float64Constant[];
479extern const float32 float32Constant[]; 482extern const float32 float32Constant[];
480 483