aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/sfp-machine.h
diff options
context:
space:
mode:
authorLiu Yu <yu.liu@freescale.com>2008-10-27 23:50:21 -0400
committerKumar Gala <galak@kernel.crashing.org>2008-12-03 09:19:16 -0500
commit6a800f36acd5bf06b5fe2cb27c4d0524d60c3df5 (patch)
treefe5611ddb3a92d5609736618aed5eb8d9e65ce7a /arch/powerpc/include/asm/sfp-machine.h
parent033b8a333c66e0a7dc63132c1bd65175dc98bc25 (diff)
powerpc: Add SPE/EFP math emulation for E500v1/v2 processors.
This patch add the handlers of SPE/EFP exceptions. The code is used to emulate float point arithmetic, when MSR(SPE) is enabled and receive EFP data interrupt or EFP round interrupt. This patch has no conflict with or dependence on FP math-emu. The code has been tested by TestFloat. Now the code doesn't support SPE/EFP instructions emulation (it won't be called when receive program interrupt), but it could be easily added. Signed-off-by: Liu Yu <yu.liu@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include/asm/sfp-machine.h')
-rw-r--r--arch/powerpc/include/asm/sfp-machine.h36
1 files changed, 26 insertions, 10 deletions
diff --git a/arch/powerpc/include/asm/sfp-machine.h b/arch/powerpc/include/asm/sfp-machine.h
index 88af036b1fef..3d9f831c3c55 100644
--- a/arch/powerpc/include/asm/sfp-machine.h
+++ b/arch/powerpc/include/asm/sfp-machine.h
@@ -97,6 +97,20 @@
97 97
98#define _FP_KEEPNANFRACP 1 98#define _FP_KEEPNANFRACP 1
99 99
100#ifdef FP_EX_BOOKE_E500_SPE
101#define FP_EX_INEXACT (1 << 21)
102#define FP_EX_INVALID (1 << 20)
103#define FP_EX_DIVZERO (1 << 19)
104#define FP_EX_UNDERFLOW (1 << 18)
105#define FP_EX_OVERFLOW (1 << 17)
106#define FP_INHIBIT_RESULTS 0
107
108#define __FPU_FPSCR (current->thread.spefscr)
109#define __FPU_ENABLED_EXC \
110({ \
111 (__FPU_FPSCR >> 2) & 0x1f; \
112})
113#else
100/* Exception flags. We use the bit positions of the appropriate bits 114/* Exception flags. We use the bit positions of the appropriate bits
101 in the FPSCR, which also correspond to the FE_* bits. This makes 115 in the FPSCR, which also correspond to the FE_* bits. This makes
102 everything easier ;-). */ 116 everything easier ;-). */
@@ -111,6 +125,18 @@
111#define FP_EX_DIVZERO (1 << (31 - 5)) 125#define FP_EX_DIVZERO (1 << (31 - 5))
112#define FP_EX_INEXACT (1 << (31 - 6)) 126#define FP_EX_INEXACT (1 << (31 - 6))
113 127
128#define __FPU_FPSCR (current->thread.fpscr.val)
129
130/* We only actually write to the destination register
131 * if exceptions signalled (if any) will not trap.
132 */
133#define __FPU_ENABLED_EXC \
134({ \
135 (__FPU_FPSCR >> 3) & 0x1f; \
136})
137
138#endif
139
114/* 140/*
115 * If one NaN is signaling and the other is not, 141 * If one NaN is signaling and the other is not,
116 * we choose that one, otherwise we choose X. 142 * we choose that one, otherwise we choose X.
@@ -135,16 +161,6 @@
135#include <linux/kernel.h> 161#include <linux/kernel.h>
136#include <linux/sched.h> 162#include <linux/sched.h>
137 163
138#define __FPU_FPSCR (current->thread.fpscr.val)
139
140/* We only actually write to the destination register
141 * if exceptions signalled (if any) will not trap.
142 */
143#define __FPU_ENABLED_EXC \
144({ \
145 (__FPU_FPSCR >> 3) & 0x1f; \
146})
147
148#define __FPU_TRAP_P(bits) \ 164#define __FPU_TRAP_P(bits) \
149 ((__FPU_ENABLED_EXC & (bits)) != 0) 165 ((__FPU_ENABLED_EXC & (bits)) != 0)
150 166