Commit 164e430f authored by Richard Henderson's avatar Richard Henderson Committed by Linus Torvalds

[PATCH] alpha fp-emu vs module refcounting

From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>

This allows building the math-emu code as a module only when
CONFIG_SMP is not set. The fp trap handler cannot be preempted
on a single-CPU (as CONFIG_PREEMPT is not going to be supported
on alpha), so the module can be safely unloaded at any time.
parent 1d399491
...@@ -626,8 +626,8 @@ config DEBUG_KERNEL ...@@ -626,8 +626,8 @@ config DEBUG_KERNEL
identify kernel problems. identify kernel problems.
config MATHEMU config MATHEMU
tristate "Kernel FP software completion" if DEBUG_KERNEL tristate "Kernel FP software completion" if DEBUG_KERNEL && !SMP
default y if !DEBUG_KERNEL default y if !DEBUG_KERNEL || SMP
help help
This option is required for IEEE compliant floating point arithmetic This option is required for IEEE compliant floating point arithmetic
on the Alpha. The only time you would ever not say Y is to say M in on the Alpha. The only time you would ever not say Y is to say M in
......
...@@ -4,4 +4,6 @@ ...@@ -4,4 +4,6 @@
EXTRA_CFLAGS := -w EXTRA_CFLAGS := -w
obj-$(CONFIG_MATHEMU) += math.o qrnnd.o obj-$(CONFIG_MATHEMU) += math-emu.o
math-emu-objs := math.o qrnnd.o
...@@ -106,8 +106,6 @@ alpha_fp_emul (unsigned long pc) ...@@ -106,8 +106,6 @@ alpha_fp_emul (unsigned long pc)
__u32 insn; __u32 insn;
long si_code; long si_code;
MOD_INC_USE_COUNT;
get_user(insn, (__u32*)pc); get_user(insn, (__u32*)pc);
fc = (insn >> 0) & 0x1f; /* destination register */ fc = (insn >> 0) & 0x1f; /* destination register */
fb = (insn >> 16) & 0x1f; fb = (insn >> 16) & 0x1f;
...@@ -320,7 +318,6 @@ alpha_fp_emul (unsigned long pc) ...@@ -320,7 +318,6 @@ alpha_fp_emul (unsigned long pc)
if (_fex & IEEE_TRAP_ENABLE_INV) si_code = FPE_FLTINV; if (_fex & IEEE_TRAP_ENABLE_INV) si_code = FPE_FLTINV;
} }
MOD_DEC_USE_COUNT;
return si_code; return si_code;
} }
...@@ -328,13 +325,11 @@ alpha_fp_emul (unsigned long pc) ...@@ -328,13 +325,11 @@ alpha_fp_emul (unsigned long pc)
requires that the result *always* be written... so we do the write requires that the result *always* be written... so we do the write
immediately after the operations above. */ immediately after the operations above. */
MOD_DEC_USE_COUNT;
return 0; return 0;
bad_insn: bad_insn:
printk(KERN_ERR "alpha_fp_emul: Invalid FP insn %#x at %#lx\n", printk(KERN_ERR "alpha_fp_emul: Invalid FP insn %#x at %#lx\n",
insn, pc); insn, pc);
MOD_DEC_USE_COUNT;
return -1; return -1;
} }
...@@ -344,8 +339,6 @@ alpha_fp_emul_imprecise (struct pt_regs *regs, unsigned long write_mask) ...@@ -344,8 +339,6 @@ alpha_fp_emul_imprecise (struct pt_regs *regs, unsigned long write_mask)
unsigned long trigger_pc = regs->pc - 4; unsigned long trigger_pc = regs->pc - 4;
unsigned long insn, opcode, rc, si_code = 0; unsigned long insn, opcode, rc, si_code = 0;
MOD_INC_USE_COUNT;
/* /*
* Turn off the bits corresponding to registers that are the * Turn off the bits corresponding to registers that are the
* target of instructions that set bits in the exception * target of instructions that set bits in the exception
...@@ -403,6 +396,5 @@ alpha_fp_emul_imprecise (struct pt_regs *regs, unsigned long write_mask) ...@@ -403,6 +396,5 @@ alpha_fp_emul_imprecise (struct pt_regs *regs, unsigned long write_mask)
} }
egress: egress:
MOD_DEC_USE_COUNT;
return si_code; return si_code;
} }
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