Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 948a34cf authored by Thiemo Seufer's avatar Thiemo Seufer Committed by Ralf Baechle
Browse files

[MIPS] Maintain si_code field properly for FP exceptions



The appended patch adds code to update siginfo_t's si_code field. It
fixes e.g. a floating point overflow regression in the SBCL testsuite.

Signed-off-By: default avatarThiemo Seufer <ths@linux-mips.org>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 34412c72
Loading
Loading
Loading
Loading
+18 −3
Original line number Original line Diff line number Diff line
@@ -606,6 +606,8 @@ asmlinkage void do_ov(struct pt_regs *regs)
 */
 */
asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
{
{
	siginfo_t info;

	die_if_kernel("FP exception in kernel code", regs);
	die_if_kernel("FP exception in kernel code", regs);


	if (fcr31 & FPU_CSR_UNI_X) {
	if (fcr31 & FPU_CSR_UNI_X) {
@@ -641,9 +643,22 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
			force_sig(sig, current);
			force_sig(sig, current);


		return;
		return;
	}
	} else if (fcr31 & FPU_CSR_INV_X)

		info.si_code = FPE_FLTINV;
	force_sig(SIGFPE, current);
	else if (fcr31 & FPU_CSR_DIV_X)
		info.si_code = FPE_FLTDIV;
	else if (fcr31 & FPU_CSR_OVF_X)
		info.si_code = FPE_FLTOVF;
	else if (fcr31 & FPU_CSR_UDF_X)
		info.si_code = FPE_FLTUND;
	else if (fcr31 & FPU_CSR_INE_X)
		info.si_code = FPE_FLTRES;
	else
		info.si_code = __SI_FAULT;
	info.si_signo = SIGFPE;
	info.si_errno = 0;
	info.si_addr = (void __user *) regs->cp0_epc;
	force_sig_info(SIGFPE, &info, current);
}
}


asmlinkage void do_bp(struct pt_regs *regs)
asmlinkage void do_bp(struct pt_regs *regs)