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
identify kernel problems.
config MATHEMU
tristate "Kernel FP software completion" if DEBUG_KERNEL
default y if !DEBUG_KERNEL
tristate "Kernel FP software completion" if DEBUG_KERNEL && !SMP
default y if !DEBUG_KERNEL || SMP
help
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
......
......@@ -4,4 +4,6 @@
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)
__u32 insn;
long si_code;
MOD_INC_USE_COUNT;
get_user(insn, (__u32*)pc);
fc = (insn >> 0) & 0x1f; /* destination register */
fb = (insn >> 16) & 0x1f;
......@@ -320,7 +318,6 @@ alpha_fp_emul (unsigned long pc)
if (_fex & IEEE_TRAP_ENABLE_INV) si_code = FPE_FLTINV;
}
MOD_DEC_USE_COUNT;
return si_code;
}
......@@ -328,13 +325,11 @@ alpha_fp_emul (unsigned long pc)
requires that the result *always* be written... so we do the write
immediately after the operations above. */
MOD_DEC_USE_COUNT;
return 0;
bad_insn:
printk(KERN_ERR "alpha_fp_emul: Invalid FP insn %#x at %#lx\n",
insn, pc);
MOD_DEC_USE_COUNT;
return -1;
}
......@@ -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 insn, opcode, rc, si_code = 0;
MOD_INC_USE_COUNT;
/*
* Turn off the bits corresponding to registers that are the
* 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)
}
egress:
MOD_DEC_USE_COUNT;
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