diff options
Diffstat (limited to 'arch/um/kernel/trap_kern.c')
| -rw-r--r-- | arch/um/kernel/trap_kern.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c index 0d4c10a73607..d56046c2aba2 100644 --- a/arch/um/kernel/trap_kern.c +++ b/arch/um/kernel/trap_kern.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) |
| 3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
| 4 | */ | 4 | */ |
| @@ -26,9 +26,13 @@ | |||
| 26 | #include "mconsole_kern.h" | 26 | #include "mconsole_kern.h" |
| 27 | #include "mem.h" | 27 | #include "mem.h" |
| 28 | #include "mem_kern.h" | 28 | #include "mem_kern.h" |
| 29 | #include "sysdep/sigcontext.h" | ||
| 30 | #include "sysdep/ptrace.h" | ||
| 31 | #include "os.h" | ||
| 29 | #ifdef CONFIG_MODE_SKAS | 32 | #ifdef CONFIG_MODE_SKAS |
| 30 | #include "skas.h" | 33 | #include "skas.h" |
| 31 | #endif | 34 | #endif |
| 35 | #include "os.h" | ||
| 32 | 36 | ||
| 33 | /* Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by segv(). */ | 37 | /* Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by segv(). */ |
| 34 | int handle_page_fault(unsigned long address, unsigned long ip, | 38 | int handle_page_fault(unsigned long address, unsigned long ip, |
| @@ -125,6 +129,25 @@ out_of_memory: | |||
| 125 | goto out; | 129 | goto out; |
| 126 | } | 130 | } |
| 127 | 131 | ||
| 132 | void segv_handler(int sig, union uml_pt_regs *regs) | ||
| 133 | { | ||
| 134 | struct faultinfo * fi = UPT_FAULTINFO(regs); | ||
| 135 | |||
| 136 | if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){ | ||
| 137 | bad_segv(*fi, UPT_IP(regs)); | ||
| 138 | return; | ||
| 139 | } | ||
| 140 | segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs); | ||
| 141 | } | ||
| 142 | |||
| 143 | struct kern_handlers handlinfo_kern = { | ||
| 144 | .relay_signal = relay_signal, | ||
| 145 | .winch = winch, | ||
| 146 | .bus_handler = relay_signal, | ||
| 147 | .page_fault = segv_handler, | ||
| 148 | .sigio_handler = sigio_handler, | ||
| 149 | .timer_handler = timer_handler | ||
| 150 | }; | ||
| 128 | /* | 151 | /* |
| 129 | * We give a *copy* of the faultinfo in the regs to segv. | 152 | * We give a *copy* of the faultinfo in the regs to segv. |
| 130 | * This must be done, since nesting SEGVs could overwrite | 153 | * This must be done, since nesting SEGVs could overwrite |
