Commit 749fb94b authored by Russell King's avatar Russell King

[ARM] Fix sparse warnings in nwfpe.

This fixes sparse warnings in fpa11_cpdt (coprocessor data transfer)
instruction emulation.  Note that pointers need to be cast to unsigned
long not unsigned int, so convert user registers to be unsigned long
type.
parent 24e25979
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* stack+task struct. Use the same method as 'current' uses to * stack+task struct. Use the same method as 'current' uses to
* reach them. * reach them.
*/ */
register unsigned int *user_registers asm("sl"); register unsigned long *user_registers asm("sl");
#define GET_USERREG() (user_registers) #define GET_USERREG() (user_registers)
......
...@@ -29,14 +29,14 @@ ...@@ -29,14 +29,14 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
static inline void loadSingle(const unsigned int Fn, const unsigned int *pMem) static inline void loadSingle(const unsigned int Fn, const unsigned int __user *pMem)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
fpa11->fType[Fn] = typeSingle; fpa11->fType[Fn] = typeSingle;
get_user(fpa11->fpreg[Fn].fSingle, pMem); get_user(fpa11->fpreg[Fn].fSingle, pMem);
} }
static inline void loadDouble(const unsigned int Fn, const unsigned int *pMem) static inline void loadDouble(const unsigned int Fn, const unsigned int __user *pMem)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
unsigned int *p; unsigned int *p;
...@@ -47,7 +47,7 @@ static inline void loadDouble(const unsigned int Fn, const unsigned int *pMem) ...@@ -47,7 +47,7 @@ static inline void loadDouble(const unsigned int Fn, const unsigned int *pMem)
} }
#ifdef CONFIG_FPE_NWFPE_XP #ifdef CONFIG_FPE_NWFPE_XP
static inline void loadExtended(const unsigned int Fn, const unsigned int *pMem) static inline void loadExtended(const unsigned int Fn, const unsigned int __user *pMem)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
unsigned int *p; unsigned int *p;
...@@ -59,7 +59,7 @@ static inline void loadExtended(const unsigned int Fn, const unsigned int *pMem) ...@@ -59,7 +59,7 @@ static inline void loadExtended(const unsigned int Fn, const unsigned int *pMem)
} }
#endif #endif
static inline void loadMultiple(const unsigned int Fn, const unsigned int *pMem) static inline void loadMultiple(const unsigned int Fn, const unsigned int __user *pMem)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
register unsigned int *p; register unsigned int *p;
...@@ -91,7 +91,7 @@ static inline void loadMultiple(const unsigned int Fn, const unsigned int *pMem) ...@@ -91,7 +91,7 @@ static inline void loadMultiple(const unsigned int Fn, const unsigned int *pMem)
} }
} }
static inline void storeSingle(const unsigned int Fn, unsigned int *pMem) static inline void storeSingle(const unsigned int Fn, unsigned int __user *pMem)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
union { union {
...@@ -117,7 +117,7 @@ static inline void storeSingle(const unsigned int Fn, unsigned int *pMem) ...@@ -117,7 +117,7 @@ static inline void storeSingle(const unsigned int Fn, unsigned int *pMem)
put_user(val.i[0], pMem); put_user(val.i[0], pMem);
} }
static inline void storeDouble(const unsigned int Fn, unsigned int *pMem) static inline void storeDouble(const unsigned int Fn, unsigned int __user *pMem)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
union { union {
...@@ -145,7 +145,7 @@ static inline void storeDouble(const unsigned int Fn, unsigned int *pMem) ...@@ -145,7 +145,7 @@ static inline void storeDouble(const unsigned int Fn, unsigned int *pMem)
} }
#ifdef CONFIG_FPE_NWFPE_XP #ifdef CONFIG_FPE_NWFPE_XP
static inline void storeExtended(const unsigned int Fn, unsigned int *pMem) static inline void storeExtended(const unsigned int Fn, unsigned int __user *pMem)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
union { union {
...@@ -172,7 +172,7 @@ static inline void storeExtended(const unsigned int Fn, unsigned int *pMem) ...@@ -172,7 +172,7 @@ static inline void storeExtended(const unsigned int Fn, unsigned int *pMem)
} }
#endif #endif
static inline void storeMultiple(const unsigned int Fn, unsigned int *pMem) static inline void storeMultiple(const unsigned int Fn, unsigned int __user *pMem)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
register unsigned int nType, *p; register unsigned int nType, *p;
...@@ -204,10 +204,10 @@ static inline void storeMultiple(const unsigned int Fn, unsigned int *pMem) ...@@ -204,10 +204,10 @@ static inline void storeMultiple(const unsigned int Fn, unsigned int *pMem)
unsigned int PerformLDF(const unsigned int opcode) unsigned int PerformLDF(const unsigned int opcode)
{ {
unsigned int *pBase, *pAddress, *pFinal, nRc = 1, unsigned int __user *pBase, *pAddress, *pFinal;
write_back = WRITE_BACK(opcode); unsigned int nRc = 1, write_back = WRITE_BACK(opcode);
pBase = (unsigned int *) readRegister(getRn(opcode)); pBase = (unsigned int __user *) readRegister(getRn(opcode));
if (REG_PC == getRn(opcode)) { if (REG_PC == getRn(opcode)) {
pBase += 2; pBase += 2;
write_back = 0; write_back = 0;
...@@ -241,18 +241,18 @@ unsigned int PerformLDF(const unsigned int opcode) ...@@ -241,18 +241,18 @@ unsigned int PerformLDF(const unsigned int opcode)
} }
if (write_back) if (write_back)
writeRegister(getRn(opcode), (unsigned int) pFinal); writeRegister(getRn(opcode), (unsigned long) pFinal);
return nRc; return nRc;
} }
unsigned int PerformSTF(const unsigned int opcode) unsigned int PerformSTF(const unsigned int opcode)
{ {
unsigned int *pBase, *pAddress, *pFinal, nRc = 1, unsigned int __user *pBase, *pAddress, *pFinal;
write_back = WRITE_BACK(opcode); unsigned int nRc = 1, write_back = WRITE_BACK(opcode);
SetRoundingMode(ROUND_TO_NEAREST); SetRoundingMode(ROUND_TO_NEAREST);
pBase = (unsigned int *) readRegister(getRn(opcode)); pBase = (unsigned int __user *) readRegister(getRn(opcode));
if (REG_PC == getRn(opcode)) { if (REG_PC == getRn(opcode)) {
pBase += 2; pBase += 2;
write_back = 0; write_back = 0;
...@@ -286,16 +286,16 @@ unsigned int PerformSTF(const unsigned int opcode) ...@@ -286,16 +286,16 @@ unsigned int PerformSTF(const unsigned int opcode)
} }
if (write_back) if (write_back)
writeRegister(getRn(opcode), (unsigned int) pFinal); writeRegister(getRn(opcode), (unsigned long) pFinal);
return nRc; return nRc;
} }
unsigned int PerformLFM(const unsigned int opcode) unsigned int PerformLFM(const unsigned int opcode)
{ {
unsigned int i, Fd, *pBase, *pAddress, *pFinal, unsigned int __user *pBase, *pAddress, *pFinal;
write_back = WRITE_BACK(opcode); unsigned int i, Fd, write_back = WRITE_BACK(opcode);
pBase = (unsigned int *) readRegister(getRn(opcode)); pBase = (unsigned int __user *) readRegister(getRn(opcode));
if (REG_PC == getRn(opcode)) { if (REG_PC == getRn(opcode)) {
pBase += 2; pBase += 2;
write_back = 0; write_back = 0;
...@@ -322,16 +322,16 @@ unsigned int PerformLFM(const unsigned int opcode) ...@@ -322,16 +322,16 @@ unsigned int PerformLFM(const unsigned int opcode)
} }
if (write_back) if (write_back)
writeRegister(getRn(opcode), (unsigned int) pFinal); writeRegister(getRn(opcode), (unsigned long) pFinal);
return 1; return 1;
} }
unsigned int PerformSFM(const unsigned int opcode) unsigned int PerformSFM(const unsigned int opcode)
{ {
unsigned int i, Fd, *pBase, *pAddress, *pFinal, unsigned int __user *pBase, *pAddress, *pFinal;
write_back = WRITE_BACK(opcode); unsigned int i, Fd, write_back = WRITE_BACK(opcode);
pBase = (unsigned int *) readRegister(getRn(opcode)); pBase = (unsigned int __user *) readRegister(getRn(opcode));
if (REG_PC == getRn(opcode)) { if (REG_PC == getRn(opcode)) {
pBase += 2; pBase += 2;
write_back = 0; write_back = 0;
...@@ -358,7 +358,7 @@ unsigned int PerformSFM(const unsigned int opcode) ...@@ -358,7 +358,7 @@ unsigned int PerformSFM(const unsigned int opcode)
} }
if (write_back) if (write_back)
writeRegister(getRn(opcode), (unsigned int) pFinal); writeRegister(getRn(opcode), (unsigned long) pFinal);
return 1; return 1;
} }
......
...@@ -131,7 +131,7 @@ void float_raise(signed char flags) ...@@ -131,7 +131,7 @@ void float_raise(signed char flags)
#ifdef CONFIG_DEBUG_USER #ifdef CONFIG_DEBUG_USER
printk(KERN_DEBUG printk(KERN_DEBUG
"NWFPE: %s[%d] takes exception %08x at %p from %08x\n", "NWFPE: %s[%d] takes exception %08x at %p from %08lx\n",
current->comm, current->pid, flags, current->comm, current->pid, flags,
__builtin_return_address(0), GET_USERREG()[15]); __builtin_return_address(0), GET_USERREG()[15]);
#endif #endif
......
...@@ -19,8 +19,7 @@ ...@@ -19,8 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
extern __inline__ static inline unsigned long readRegister(const unsigned int nReg)
unsigned int readRegister(const unsigned int nReg)
{ {
/* Note: The CPU thinks it has dealt with the current instruction. /* Note: The CPU thinks it has dealt with the current instruction.
As a result the program counter has been advanced to the next As a result the program counter has been advanced to the next
...@@ -29,34 +28,31 @@ unsigned int readRegister(const unsigned int nReg) ...@@ -29,34 +28,31 @@ unsigned int readRegister(const unsigned int nReg)
for this in this routine. LDF/STF instructions with Rn = PC for this in this routine. LDF/STF instructions with Rn = PC
depend on the PC being correct, as they use PC+8 in their depend on the PC being correct, as they use PC+8 in their
address calculations. */ address calculations. */
unsigned int *userRegisters = GET_USERREG(); unsigned long *userRegisters = GET_USERREG();
unsigned int val = userRegisters[nReg]; unsigned int val = userRegisters[nReg];
if (REG_PC == nReg) if (REG_PC == nReg)
val -= 4; val -= 4;
return val; return val;
} }
extern __inline__ static inline void
void writeRegister(const unsigned int nReg, const unsigned int val) writeRegister(const unsigned int nReg, const unsigned long val)
{ {
unsigned int *userRegisters = GET_USERREG(); unsigned long *userRegisters = GET_USERREG();
userRegisters[nReg] = val; userRegisters[nReg] = val;
} }
extern __inline__ static inline unsigned long readCPSR(void)
unsigned int readCPSR(void)
{ {
return (readRegister(REG_CPSR)); return (readRegister(REG_CPSR));
} }
extern __inline__ static inline void writeCPSR(const unsigned long val)
void writeCPSR(const unsigned int val)
{ {
writeRegister(REG_CPSR, val); writeRegister(REG_CPSR, val);
} }
extern __inline__ static inline unsigned long readConditionCodes(void)
unsigned int readConditionCodes(void)
{ {
#ifdef __FPEM_TEST__ #ifdef __FPEM_TEST__
return (0); return (0);
...@@ -65,11 +61,10 @@ unsigned int readConditionCodes(void) ...@@ -65,11 +61,10 @@ unsigned int readConditionCodes(void)
#endif #endif
} }
extern __inline__ static inline void writeConditionCodes(const unsigned long val)
void writeConditionCodes(const unsigned int val)
{ {
unsigned int *userRegisters = GET_USERREG(); unsigned long *userRegisters = GET_USERREG();
unsigned int rval; unsigned long rval;
/* /*
* Operate directly on userRegisters since * Operate directly on userRegisters since
* the CPSR may be the PC register itself. * the CPSR may be the PC register itself.
...@@ -77,9 +72,3 @@ void writeConditionCodes(const unsigned int val) ...@@ -77,9 +72,3 @@ void writeConditionCodes(const unsigned int val)
rval = userRegisters[REG_CPSR] & ~CC_MASK; rval = userRegisters[REG_CPSR] & ~CC_MASK;
userRegisters[REG_CPSR] = rval | (val & CC_MASK); userRegisters[REG_CPSR] = rval | (val & CC_MASK);
} }
extern __inline__
unsigned int readMemoryInt(unsigned int *pMem)
{
return *pMem;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment