Commit e78e17ad authored by Russell King's avatar Russell King

[ARM] Update nwfpe to use new fp_init hook.

Take FPA11_CheckInit out of the hot path, and use the fp_init hook
instead.
parent 6c7a027f
...@@ -73,8 +73,6 @@ nwfpe_enter: ...@@ -73,8 +73,6 @@ nwfpe_enter:
mov r4, lr @ save the failure-return addresses mov r4, lr @ save the failure-return addresses
mov sl, sp mov sl, sp
bl FPA11_CheckInit @ check to see if we are initialised
ldr r5, [sp, #60] @ get contents of PC; ldr r5, [sp, #60] @ get contents of PC;
sub r8, r5, #4 sub r8, r5, #4
.Lx2: ldrt r0, [r8] @ get actual instruction into r0 .Lx2: ldrt r0, [r8] @ get actual instruction into r0
......
...@@ -66,7 +66,6 @@ several floating point instructions. */ ...@@ -66,7 +66,6 @@ several floating point instructions. */
.globl nwfpe_enter .globl nwfpe_enter
nwfpe_enter: nwfpe_enter:
mov sl, sp mov sl, sp
bl FPA11_CheckInit @ check to see if we are initialised
ldr r5, [sp, #60] @ get contents of PC ldr r5, [sp, #60] @ get contents of PC
bic r5, r5, #0xfc000003 bic r5, r5, #0xfc000003
......
...@@ -34,7 +34,7 @@ unsigned int EmulateCPDT(const unsigned int); ...@@ -34,7 +34,7 @@ unsigned int EmulateCPDT(const unsigned int);
unsigned int EmulateCPRT(const unsigned int); unsigned int EmulateCPRT(const unsigned int);
/* Reset the FPA11 chip. Called to initialize and reset the emulator. */ /* Reset the FPA11 chip. Called to initialize and reset the emulator. */
void resetFPA11(void) static void resetFPA11(void)
{ {
int i; int i;
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
...@@ -126,16 +126,14 @@ void SetRoundingPrecision(const unsigned int opcode) ...@@ -126,16 +126,14 @@ void SetRoundingPrecision(const unsigned int opcode)
} }
} }
void FPA11_CheckInit(void) void nwfpe_init(union fp_state *fp)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = (FPA11 *)fp;
if (unlikely(fpa11->initflag == 0)) memset(fpa11, 0, sizeof(FPA11));
{
resetFPA11(); resetFPA11();
SetRoundingMode(ROUND_TO_NEAREST); SetRoundingMode(ROUND_TO_NEAREST);
SetRoundingPrecision(ROUND_EXTENDED); SetRoundingPrecision(ROUND_EXTENDED);
fpa11->initflag = 1; fpa11->initflag = 1;
}
} }
/* Emulate the instruction in the opcode. */ /* Emulate the instruction in the opcode. */
......
...@@ -80,8 +80,8 @@ typedef struct tagFPA11 { ...@@ -80,8 +80,8 @@ typedef struct tagFPA11 {
initialised. */ initialised. */
} FPA11; } FPA11;
extern void resetFPA11(void);
extern void SetRoundingMode(const unsigned int); extern void SetRoundingMode(const unsigned int);
extern void SetRoundingPrecision(const unsigned int); extern void SetRoundingPrecision(const unsigned int);
extern void nwfpe_init(union fp_state *fp);
#endif #endif
...@@ -42,10 +42,8 @@ ...@@ -42,10 +42,8 @@
#include "fpa11.inl" #include "fpa11.inl"
/* kernel symbols required for signal handling */ /* kernel symbols required for signal handling */
typedef struct task_struct* PTASK;
#ifdef MODULE #ifdef MODULE
void fp_send_sig(unsigned long sig, PTASK p, int priv); void fp_send_sig(unsigned long sig, struct task_struct *p, int priv);
#if LINUX_VERSION_CODE > 0x20115 #if LINUX_VERSION_CODE > 0x20115
MODULE_AUTHOR("Scott Bambrough <scottb@rebel.com>"); MODULE_AUTHOR("Scott Bambrough <scottb@rebel.com>");
MODULE_DESCRIPTION("NWFPE floating point emulator"); MODULE_DESCRIPTION("NWFPE floating point emulator");
...@@ -63,9 +61,11 @@ void fp_setup(void); ...@@ -63,9 +61,11 @@ void fp_setup(void);
/* external declarations for saved kernel symbols */ /* external declarations for saved kernel symbols */
extern void (*kern_fp_enter)(void); extern void (*kern_fp_enter)(void);
extern void (*fp_init)(union fp_state *);
/* Original value of fp_enter from kernel before patched by fpe_init. */ /* Original value of fp_enter from kernel before patched by fpe_init. */
static void (*orig_fp_enter)(void); static void (*orig_fp_enter)(void);
static void (*orig_fp_init)(union fp_state *);
/* forward declarations */ /* forward declarations */
extern void nwfpe_enter(void); extern void nwfpe_enter(void);
...@@ -108,7 +108,9 @@ static int __init fpe_init(void) ...@@ -108,7 +108,9 @@ static int __init fpe_init(void)
/* Save pointer to the old FP handler and then patch ourselves in */ /* Save pointer to the old FP handler and then patch ourselves in */
orig_fp_enter = kern_fp_enter; orig_fp_enter = kern_fp_enter;
orig_fp_init = fp_init;
kern_fp_enter = nwfpe_enter; kern_fp_enter = nwfpe_enter;
fp_init = nwfpe_init;
return 0; return 0;
} }
...@@ -117,6 +119,7 @@ static void __exit fpe_exit(void) ...@@ -117,6 +119,7 @@ static void __exit fpe_exit(void)
{ {
/* Restore the values we saved earlier. */ /* Restore the values we saved earlier. */
kern_fp_enter = orig_fp_enter; kern_fp_enter = orig_fp_enter;
fp_init = orig_fp_init;
} }
/* /*
......
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