Deleted Added
full compact
trap.c (257417) trap.c (258259)
1/*-
2 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
3 * Copyright (C) 1995, 1996 TooLs GmbH.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * $NetBSD: trap.c,v 1.58 2002/03/04 04:07:35 dbj Exp $
32 */
33
34#include <sys/cdefs.h>
1/*-
2 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
3 * Copyright (C) 1995, 1996 TooLs GmbH.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * $NetBSD: trap.c,v 1.58 2002/03/04 04:07:35 dbj Exp $
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/powerpc/aim/trap.c 257417 2013-10-31 02:35:00Z markj $");
35__FBSDID("$FreeBSD: head/sys/powerpc/aim/trap.c 258259 2013-11-17 15:12:03Z nwhitehorn $");
36
37#include "opt_kdtrace.h"
38
39#include <sys/param.h>
40#include <sys/kdb.h>
41#include <sys/proc.h>
42#include <sys/ktr.h>
43#include <sys/lock.h>

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

75#include <machine/spr.h>
76#include <machine/sr.h>
77
78static void trap_fatal(struct trapframe *frame);
79static void printtrap(u_int vector, struct trapframe *frame, int isfatal,
80 int user);
81static int trap_pfault(struct trapframe *frame, int user);
82static int fix_unaligned(struct thread *td, struct trapframe *frame);
36
37#include "opt_kdtrace.h"
38
39#include <sys/param.h>
40#include <sys/kdb.h>
41#include <sys/proc.h>
42#include <sys/ktr.h>
43#include <sys/lock.h>

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

75#include <machine/spr.h>
76#include <machine/sr.h>
77
78static void trap_fatal(struct trapframe *frame);
79static void printtrap(u_int vector, struct trapframe *frame, int isfatal,
80 int user);
81static int trap_pfault(struct trapframe *frame, int user);
82static int fix_unaligned(struct thread *td, struct trapframe *frame);
83static int ppc_instr_emulate(struct trapframe *frame);
84static int handle_onfault(struct trapframe *frame);
85static void syscall(struct trapframe *frame);
86
87#ifdef __powerpc64__
88 void handle_kernel_slb_spill(int, register_t, register_t);
89static int handle_user_slb_spill(pmap_t pm, vm_offset_t addr);
90extern int n_slbs;
91#endif

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

287 if (inst == 0x0FFFDDDD && dtrace_pid_probe_ptr != NULL) {
288 struct reg regs;
289 fill_regs(td, &regs);
290 (*dtrace_pid_probe_ptr)(&regs);
291 break;
292 }
293#endif
294 sig = SIGTRAP;
83static int handle_onfault(struct trapframe *frame);
84static void syscall(struct trapframe *frame);
85
86#ifdef __powerpc64__
87 void handle_kernel_slb_spill(int, register_t, register_t);
88static int handle_user_slb_spill(pmap_t pm, vm_offset_t addr);
89extern int n_slbs;
90#endif

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

286 if (inst == 0x0FFFDDDD && dtrace_pid_probe_ptr != NULL) {
287 struct reg regs;
288 fill_regs(td, &regs);
289 (*dtrace_pid_probe_ptr)(&regs);
290 break;
291 }
292#endif
293 sig = SIGTRAP;
295 } else if (ppc_instr_emulate(frame) == 0)
296 frame->srr0 += 4;
297 else
298 sig = SIGILL;
294 } else {
295 sig = ppc_instr_emulate(frame, td->td_pcb);
296 }
299 break;
300
301 default:
302 trap_fatal(frame);
303 }
304 } else {
305 /* Kernel Mode Traps */
306

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

795 }
796 return 0;
797 break;
798 }
799
800 return -1;
801}
802
297 break;
298
299 default:
300 trap_fatal(frame);
301 }
302 } else {
303 /* Kernel Mode Traps */
304

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

793 }
794 return 0;
795 break;
796 }
797
798 return -1;
799}
800
803static int
804ppc_instr_emulate(struct trapframe *frame)
805{
806 uint32_t instr;
807 int reg;
808
809 instr = fuword32((void *)frame->srr0);
810
811 if ((instr & 0xfc1fffff) == 0x7c1f42a6) { /* mfpvr */
812 reg = (instr & ~0xfc1fffff) >> 21;
813 frame->fixreg[reg] = mfpvr();
814 return (0);
815 }
816
817 return (-1);
818}
819