aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2008-11-18 15:25:17 -0500
committerGeert Uytterhoeven <geert@linux-m68k.org>2011-03-16 14:10:40 -0400
commitdcdf3a293522e6ef09d8b3650ac1ceec56438e5d (patch)
treed890d29cd098f39aa742c16eec404e90ef6bd1bc /arch/m68k
parent521cb40b0c44418a4fd36dc633f575813d59a43d (diff)
m68k: Add helper function handle_kernel_fault()
Add helper function handle_kernel_fault() in signal.c, so frame_extra_sizes can become static, and to avoid future code duplication. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch/m68k')
-rw-r--r--arch/m68k/include/asm/processor.h2
-rw-r--r--arch/m68k/kernel/signal.c24
-rw-r--r--arch/m68k/mm/fault.c16
3 files changed, 26 insertions, 16 deletions
diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h
index 278c69bad57a..f111b02b704f 100644
--- a/arch/m68k/include/asm/processor.h
+++ b/arch/m68k/include/asm/processor.h
@@ -113,6 +113,8 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
113 wrusp(usp); 113 wrusp(usp);
114} 114}
115 115
116extern int handle_kernel_fault(struct pt_regs *regs);
117
116#else 118#else
117 119
118/* 120/*
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index d12c3b0d9e4f..a0afc239304e 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -42,6 +42,7 @@
42#include <linux/personality.h> 42#include <linux/personality.h>
43#include <linux/tty.h> 43#include <linux/tty.h>
44#include <linux/binfmts.h> 44#include <linux/binfmts.h>
45#include <linux/module.h>
45 46
46#include <asm/setup.h> 47#include <asm/setup.h>
47#include <asm/uaccess.h> 48#include <asm/uaccess.h>
@@ -51,7 +52,7 @@
51 52
52#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 53#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
53 54
54const int frame_extra_sizes[16] = { 55static const int frame_extra_sizes[16] = {
55 [1] = -1, /* sizeof(((struct frame *)0)->un.fmt1), */ 56 [1] = -1, /* sizeof(((struct frame *)0)->un.fmt1), */
56 [2] = sizeof(((struct frame *)0)->un.fmt2), 57 [2] = sizeof(((struct frame *)0)->un.fmt2),
57 [3] = sizeof(((struct frame *)0)->un.fmt3), 58 [3] = sizeof(((struct frame *)0)->un.fmt3),
@@ -69,6 +70,27 @@ const int frame_extra_sizes[16] = {
69 [15] = -1, /* sizeof(((struct frame *)0)->un.fmtf), */ 70 [15] = -1, /* sizeof(((struct frame *)0)->un.fmtf), */
70}; 71};
71 72
73int handle_kernel_fault(struct pt_regs *regs)
74{
75 const struct exception_table_entry *fixup;
76 struct pt_regs *tregs;
77
78 /* Are we prepared to handle this kernel fault? */
79 fixup = search_exception_tables(regs->pc);
80 if (!fixup)
81 return 0;
82
83 /* Create a new four word stack frame, discarding the old one. */
84 regs->stkadj = frame_extra_sizes[regs->format];
85 tregs = (struct pt_regs *)((long)regs + regs->stkadj);
86 tregs->vector = regs->vector;
87 tregs->format = 0;
88 tregs->pc = fixup->fixup;
89 tregs->sr = regs->sr;
90
91 return 1;
92}
93
72/* 94/*
73 * Atomically swap in the new signal mask, and wait for a signal. 95 * Atomically swap in the new signal mask, and wait for a signal.
74 */ 96 */
diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c
index a96394a0333d..2db6099784ba 100644
--- a/arch/m68k/mm/fault.c
+++ b/arch/m68k/mm/fault.c
@@ -18,7 +18,6 @@
18#include <asm/pgalloc.h> 18#include <asm/pgalloc.h>
19 19
20extern void die_if_kernel(char *, struct pt_regs *, long); 20extern void die_if_kernel(char *, struct pt_regs *, long);
21extern const int frame_extra_sizes[]; /* in m68k/kernel/signal.c */
22 21
23int send_fault_sig(struct pt_regs *regs) 22int send_fault_sig(struct pt_regs *regs)
24{ 23{
@@ -35,21 +34,8 @@ int send_fault_sig(struct pt_regs *regs)
35 force_sig_info(siginfo.si_signo, 34 force_sig_info(siginfo.si_signo,
36 &siginfo, current); 35 &siginfo, current);
37 } else { 36 } else {
38 const struct exception_table_entry *fixup; 37 if (handle_kernel_fault(regs))
39
40 /* Are we prepared to handle this kernel fault? */
41 if ((fixup = search_exception_tables(regs->pc))) {
42 struct pt_regs *tregs;
43 /* Create a new four word stack frame, discarding the old
44 one. */
45 regs->stkadj = frame_extra_sizes[regs->format];
46 tregs = (struct pt_regs *)((ulong)regs + regs->stkadj);
47 tregs->vector = regs->vector;
48 tregs->format = 0;
49 tregs->pc = fixup->fixup;
50 tregs->sr = regs->sr;
51 return -1; 38 return -1;
52 }
53 39
54 //if (siginfo.si_signo == SIGBUS) 40 //if (siginfo.si_signo == SIGBUS)
55 // force_sig_info(siginfo.si_signo, 41 // force_sig_info(siginfo.si_signo,