Deleted Added
full compact
trap.c (295893) trap.c (296614)
1/*-
2 * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
3 * All rights reserved.
4 *
5 * Portions of this software were developed by SRI International and the
6 * University of Cambridge Computer Laboratory under DARPA/AFRL contract
7 * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
8 *

--- 19 unchanged lines hidden (view full) ---

28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 */
34
35#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
3 * All rights reserved.
4 *
5 * Portions of this software were developed by SRI International and the
6 * University of Cambridge Computer Laboratory under DARPA/AFRL contract
7 * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
8 *

--- 19 unchanged lines hidden (view full) ---

28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 */
34
35#include <sys/cdefs.h>
36__FBSDID("$FreeBSD: head/sys/riscv/riscv/trap.c 295893 2016-02-22 14:54:50Z br $");
36__FBSDID("$FreeBSD: head/sys/riscv/riscv/trap.c 296614 2016-03-10 15:51:43Z br $");
37
38#include <sys/param.h>
39#include <sys/systm.h>
40#include <sys/kernel.h>
41#include <sys/lock.h>
42#include <sys/mutex.h>
43#include <sys/pioctl.h>
44#include <sys/bus.h>
45#include <sys/proc.h>
46#include <sys/ptrace.h>
47#include <sys/syscall.h>
48#include <sys/sysent.h>
37
38#include <sys/param.h>
39#include <sys/systm.h>
40#include <sys/kernel.h>
41#include <sys/lock.h>
42#include <sys/mutex.h>
43#include <sys/pioctl.h>
44#include <sys/bus.h>
45#include <sys/proc.h>
46#include <sys/ptrace.h>
47#include <sys/syscall.h>
48#include <sys/sysent.h>
49#ifdef KDB
50#include <sys/kdb.h>
51#endif
49
50#include <vm/vm.h>
51#include <vm/pmap.h>
52#include <vm/vm_kern.h>
53#include <vm/vm_map.h>
54#include <vm/vm_param.h>
55#include <vm/vm_extern.h>
56

--- 105 unchanged lines hidden (view full) ---

162 struct pcb *pcb;
163 vm_prot_t ftype;
164 vm_offset_t va;
165 struct proc *p;
166 int ucode;
167 int error;
168 int sig;
169
52
53#include <vm/vm.h>
54#include <vm/pmap.h>
55#include <vm/vm_kern.h>
56#include <vm/vm_map.h>
57#include <vm/vm_param.h>
58#include <vm/vm_extern.h>
59

--- 105 unchanged lines hidden (view full) ---

165 struct pcb *pcb;
166 vm_prot_t ftype;
167 vm_offset_t va;
168 struct proc *p;
169 int ucode;
170 int error;
171 int sig;
172
173#ifdef KDB
174 if (kdb_active) {
175 kdb_reenter();
176 return;
177 }
178#endif
179
170 td = curthread;
171 pcb = td->td_pcb;
172
173 /*
174 * Special case for fuswintr and suswintr. These can't sleep so
175 * handle them early on in the trap handler.
176 */
177 if (__predict_false(pcb->pcb_onfault == (vm_offset_t)&fsu_intr_fault)) {

--- 94 unchanged lines hidden (view full) ---

272 break;
273 case EXCP_INSTR_BREAKPOINT:
274#ifdef KDB
275 kdb_trap(exception, 0, frame);
276#else
277 dump_regs(frame);
278 panic("No debugger in kernel.\n");
279#endif
180 td = curthread;
181 pcb = td->td_pcb;
182
183 /*
184 * Special case for fuswintr and suswintr. These can't sleep so
185 * handle them early on in the trap handler.
186 */
187 if (__predict_false(pcb->pcb_onfault == (vm_offset_t)&fsu_intr_fault)) {

--- 94 unchanged lines hidden (view full) ---

282 break;
283 case EXCP_INSTR_BREAKPOINT:
284#ifdef KDB
285 kdb_trap(exception, 0, frame);
286#else
287 dump_regs(frame);
288 panic("No debugger in kernel.\n");
289#endif
290 break;
280 case EXCP_INSTR_ILLEGAL:
281 dump_regs(frame);
282 panic("Illegal instruction at %x\n", frame->tf_sepc);
283 break;
284 default:
285 dump_regs(frame);
286 panic("Unknown kernel exception %x badaddr %lx\n",
287 exception, frame->tf_sbadaddr);

--- 46 unchanged lines hidden ---
291 case EXCP_INSTR_ILLEGAL:
292 dump_regs(frame);
293 panic("Illegal instruction at %x\n", frame->tf_sepc);
294 break;
295 default:
296 dump_regs(frame);
297 panic("Unknown kernel exception %x badaddr %lx\n",
298 exception, frame->tf_sbadaddr);

--- 46 unchanged lines hidden ---