summary refs log tree commit diff
path: root/arch/csky/mm
diff options
context:
space:
mode:
authorGuo Ren <guoren@linux.alibaba.com>2020-03-31 23:45:52 +0800
committerGuo Ren <guoren@linux.alibaba.com>2020-04-01 00:06:40 +0800
commit9c0e343d7654a329d1f9b53d253cbf7fb6eff85d (patch)
treea51bfcdbb5d8191b5a1414f9b798b4f38f0e8efa /arch/csky/mm
parentdd7c983e78a28ff0b22f8bcf32a303b4f79cb318 (diff)
downloadlinux-9c0e343d7654a329d1f9b53d253cbf7fb6eff85d.tar.gz
csky: Fixup get wrong psr value from phyical reg
We should get psr value from regs->psr in stack, not directly get
it from phyiscal register then save the vector number in
tsk->trap_no.

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Diffstat (limited to 'arch/csky/mm')
-rw-r--r--arch/csky/mm/fault.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/csky/mm/fault.c b/arch/csky/mm/fault.c
index f76618b630f9..562c7f708749 100644
--- a/arch/csky/mm/fault.c
+++ b/arch/csky/mm/fault.c
@@ -179,11 +179,14 @@ bad_area:
 bad_area_nosemaphore:
 	/* User mode accesses just cause a SIGSEGV */
 	if (user_mode(regs)) {
+		tsk->thread.trap_no = (regs->sr >> 16) & 0xff;
 		force_sig_fault(SIGSEGV, si_code, (void __user *)address);
 		return;
 	}
 
 no_context:
+	tsk->thread.trap_no = (regs->sr >> 16) & 0xff;
+
 	/* Are we prepared to handle this kernel fault? */
 	if (fixup_exception(regs))
 		return;
@@ -198,6 +201,8 @@ no_context:
 	die_if_kernel("Oops", regs, write);
 
 out_of_memory:
+	tsk->thread.trap_no = (regs->sr >> 16) & 0xff;
+
 	/*
 	 * We ran out of memory, call the OOM killer, and return the userspace
 	 * (which will retry the fault, or kill us if we got oom-killed).
@@ -206,6 +211,8 @@ out_of_memory:
 	return;
 
 do_sigbus:
+	tsk->thread.trap_no = (regs->sr >> 16) & 0xff;
+
 	up_read(&mm->mmap_sem);
 
 	/* Kernel mode? Handle exceptions or die */