aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/kernel
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/kernel
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/kernel')
-rw-r--r--arch/m68k/kernel/signal.c24
1 files changed, 23 insertions, 1 deletions
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 */