aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/nwfpe
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-07-17 05:54:50 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-07-17 05:54:50 -0400
commitb66da4a4859b0be3f12575863bf1d873116d1947 (patch)
tree70312c230efd0420817906adc2733489026153e9 /arch/arm/nwfpe
parentf60f700876cd51de9de69f3a3c865d95e287a24d (diff)
[PATCH] ARM: Remove global nwfpe register variable
Recent changes to nwfpe broke the build with some gcc versions: In file included from arch/arm/nwfpe/softfloat.c:33: arch/arm/nwfpe/fpa11.h:32: global register variable follows a function definition make[1]: *** [arch/arm/nwfpe/softfloat.o] Error 1 Since we now ensure that the kernel stack is empty when returning to user space, we can now access the userspace registers with reference to the kernel stack using current_thread_info(), rather than remembering the stack pointer at the time nwfpe was called. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/nwfpe')
-rw-r--r--arch/arm/nwfpe/fpa11.h4
-rw-r--r--arch/arm/nwfpe/fpmodule.c2
-rw-r--r--arch/arm/nwfpe/fpmodule.inl14
3 files changed, 9 insertions, 11 deletions
diff --git a/arch/arm/nwfpe/fpa11.h b/arch/arm/nwfpe/fpa11.h
index 45cc65426a22..e4a61aea534b 100644
--- a/arch/arm/nwfpe/fpa11.h
+++ b/arch/arm/nwfpe/fpa11.h
@@ -29,9 +29,7 @@
29 * stack+task struct. Use the same method as 'current' uses to 29 * stack+task struct. Use the same method as 'current' uses to
30 * reach them. 30 * reach them.
31 */ 31 */
32register unsigned long *user_registers asm("sl"); 32#define GET_USERREG() ((struct pt_regs *)(THREAD_START_SP + (unsigned long)current_thread_info()) - 1)
33
34#define GET_USERREG() (user_registers)
35 33
36#include <linux/config.h> 34#include <linux/config.h>
37#include <linux/thread_info.h> 35#include <linux/thread_info.h>
diff --git a/arch/arm/nwfpe/fpmodule.c b/arch/arm/nwfpe/fpmodule.c
index a8efcf34888e..12885f31d347 100644
--- a/arch/arm/nwfpe/fpmodule.c
+++ b/arch/arm/nwfpe/fpmodule.c
@@ -132,7 +132,7 @@ void float_raise(signed char flags)
132 printk(KERN_DEBUG 132 printk(KERN_DEBUG
133 "NWFPE: %s[%d] takes exception %08x at %p from %08lx\n", 133 "NWFPE: %s[%d] takes exception %08x at %p from %08lx\n",
134 current->comm, current->pid, flags, 134 current->comm, current->pid, flags,
135 __builtin_return_address(0), GET_USERREG()[15]); 135 __builtin_return_address(0), GET_USERREG()->ARM_pc);
136#endif 136#endif
137 137
138 /* Keep SoftFloat exception flags up to date. */ 138 /* Keep SoftFloat exception flags up to date. */
diff --git a/arch/arm/nwfpe/fpmodule.inl b/arch/arm/nwfpe/fpmodule.inl
index e5f59e9a3022..2c39ad408f22 100644
--- a/arch/arm/nwfpe/fpmodule.inl
+++ b/arch/arm/nwfpe/fpmodule.inl
@@ -28,8 +28,8 @@ static inline unsigned long readRegister(const unsigned int nReg)
28 for this in this routine. LDF/STF instructions with Rn = PC 28 for this in this routine. LDF/STF instructions with Rn = PC
29 depend on the PC being correct, as they use PC+8 in their 29 depend on the PC being correct, as they use PC+8 in their
30 address calculations. */ 30 address calculations. */
31 unsigned long *userRegisters = GET_USERREG(); 31 struct pt_regs *regs = GET_USERREG();
32 unsigned int val = userRegisters[nReg]; 32 unsigned int val = regs->uregs[nReg];
33 if (REG_PC == nReg) 33 if (REG_PC == nReg)
34 val -= 4; 34 val -= 4;
35 return val; 35 return val;
@@ -38,8 +38,8 @@ static inline unsigned long readRegister(const unsigned int nReg)
38static inline void 38static inline void
39writeRegister(const unsigned int nReg, const unsigned long val) 39writeRegister(const unsigned int nReg, const unsigned long val)
40{ 40{
41 unsigned long *userRegisters = GET_USERREG(); 41 struct pt_regs *regs = GET_USERREG();
42 userRegisters[nReg] = val; 42 regs->uregs[nReg] = val;
43} 43}
44 44
45static inline unsigned long readCPSR(void) 45static inline unsigned long readCPSR(void)
@@ -63,12 +63,12 @@ static inline unsigned long readConditionCodes(void)
63 63
64static inline void writeConditionCodes(const unsigned long val) 64static inline void writeConditionCodes(const unsigned long val)
65{ 65{
66 unsigned long *userRegisters = GET_USERREG(); 66 struct pt_regs *regs = GET_USERREG();
67 unsigned long rval; 67 unsigned long rval;
68 /* 68 /*
69 * Operate directly on userRegisters since 69 * Operate directly on userRegisters since
70 * the CPSR may be the PC register itself. 70 * the CPSR may be the PC register itself.
71 */ 71 */
72 rval = userRegisters[REG_CPSR] & ~CC_MASK; 72 rval = regs->ARM_cpsr & ~CC_MASK;
73 userRegisters[REG_CPSR] = rval | (val & CC_MASK); 73 regs->ARM_cpsr = rval | (val & CC_MASK);
74} 74}