Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/arm frame -> tf
details: https://anonhg.NetBSD.org/src/rev/357bd90994d8
branches: trunk
changeset: 794075:357bd90994d8
user: matt <matt%NetBSD.org@localhost>
date: Wed Mar 05 02:18:30 2014 +0000
description:
frame -> tf
printf out the insn, faulting pc, lr, sp when we get an undefined insn
int the kernel.
diffstat:
sys/arch/arm/arm/undefined.c | 59 ++++++++++++++++++++++---------------------
1 files changed, 30 insertions(+), 29 deletions(-)
diffs (200 lines):
diff -r 91af752ce2c9 -r 357bd90994d8 sys/arch/arm/arm/undefined.c
--- a/sys/arch/arm/arm/undefined.c Wed Mar 05 02:17:21 2014 +0000
+++ b/sys/arch/arm/arm/undefined.c Wed Mar 05 02:18:30 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: undefined.c,v 1.51 2014/01/29 18:45:21 matt Exp $ */
+/* $NetBSD: undefined.c,v 1.52 2014/03/05 02:18:30 matt Exp $ */
/*
* Copyright (c) 2001 Ben Harris.
@@ -54,7 +54,7 @@
#include <sys/kgdb.h>
#endif
-__KERNEL_RCSID(0, "$NetBSD: undefined.c,v 1.51 2014/01/29 18:45:21 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: undefined.c,v 1.52 2014/03/05 02:18:30 matt Exp $");
#include <sys/kmem.h>
#include <sys/queue.h>
@@ -128,12 +128,12 @@
EVCNT_ATTACH_STATIC(cp15_ev);
static int
-cp15_trapper(u_int addr, u_int insn, struct trapframe *frame, int code)
+cp15_trapper(u_int addr, u_int insn, struct trapframe *tf, int code)
{
struct lwp * const l = curlwp;
#if defined(THUMB_CODE) && !defined(CPU_ARMV7)
- if (frame->tf_spsr & PSR_T_bit)
+ if (tf->tf_spsr & PSR_T_bit)
return 1;
#endif
if (code != FAULT_USER)
@@ -149,14 +149,14 @@
/*
* Get a pointer to the register used in the instruction to be emulated.
*/
- register_t * const regp = &frame->tf_r0 + regno;
+ register_t * const regp = &tf->tf_r0 + regno;
/*
* Handle MRC p15, 0, <Rd>, c13, c0, 3 (Read User read-only thread id)
*/
if ((insn & 0xffff0fff) == 0xee1d0f70) {
*regp = (uintptr_t)l->l_private;
- frame->tf_pc += INSN_SIZE;
+ tf->tf_pc += INSN_SIZE;
cp15_ev.ev_count++;
return 0;
}
@@ -170,7 +170,7 @@
*regp = pcb->pcb_user_pid_rw;
else
pcb->pcb_user_pid_rw = *regp;
- frame->tf_pc += INSN_SIZE;
+ tf->tf_pc += INSN_SIZE;
cp15_ev.ev_count++;
return 0;
}
@@ -179,12 +179,12 @@
}
static int
-gdb_trapper(u_int addr, u_int insn, struct trapframe *frame, int code)
+gdb_trapper(u_int addr, u_int insn, struct trapframe *tf, int code)
{
struct lwp * const l = curlwp;
#ifdef THUMB_CODE
- if (frame->tf_spsr & PSR_T_bit) {
+ if (tf->tf_spsr & PSR_T_bit) {
if (insn == GDB_THUMB_BREAKPOINT)
goto bkpt;
}
@@ -207,7 +207,7 @@
return 0;
}
#ifdef KGDB
- return !kgdb_trap(T_BREAKPOINT, frame);
+ return !kgdb_trap(T_BREAKPOINT, tf);
#endif
}
}
@@ -247,10 +247,10 @@
EVCNT_ATTACH_STATIC(und_ev);
void
-undefinedinstruction(trapframe_t *frame)
+undefinedinstruction(trapframe_t *tf)
{
struct lwp *l;
- u_int fault_pc;
+ vaddr_t fault_pc;
int fault_instruction;
int fault_code;
int coprocessor;
@@ -264,36 +264,36 @@
/* Enable interrupts if they were enabled before the exception. */
#ifdef acorn26
- if ((frame->tf_r15 & R15_IRQ_DISABLE) == 0)
+ if ((tf->tf_r15 & R15_IRQ_DISABLE) == 0)
int_on();
#else
- restore_interrupts(frame->tf_spsr & IF32_bits);
+ restore_interrupts(tf->tf_spsr & IF32_bits);
#endif
#ifndef acorn26
#ifdef THUMB_CODE
- if (frame->tf_spsr & PSR_T_bit)
- frame->tf_pc -= THUMB_INSN_SIZE;
+ if (tf->tf_spsr & PSR_T_bit)
+ tf->tf_pc -= THUMB_INSN_SIZE;
else
#endif
{
- frame->tf_pc -= INSN_SIZE;
+ tf->tf_pc -= INSN_SIZE;
}
#endif
#ifdef __PROG26
- fault_pc = frame->tf_r15 & R15_PC;
+ fault_pc = tf->tf_r15 & R15_PC;
#else
- fault_pc = frame->tf_pc;
+ fault_pc = tf->tf_pc;
#endif
/* Get the current lwp/proc structure or lwp0/proc0 if there is none. */
l = curlwp;
#ifdef __PROG26
- if ((frame->tf_r15 & R15_MODE) == R15_MODE_USR) {
+ if ((tf->tf_r15 & R15_MODE) == R15_MODE_USR) {
#else
- if ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) {
+ if ((tf->tf_spsr & PSR_MODE) == PSR_USR32_MODE) {
#endif
user = 1;
LWP_CACHE_CREDS(l, l->l_proc);
@@ -302,7 +302,7 @@
#ifdef THUMB_CODE
- if (frame->tf_spsr & PSR_T_bit) {
+ if (tf->tf_spsr & PSR_T_bit) {
fault_instruction = read_thumb_insn(fault_pc, user);
if (fault_instruction >= 0xe000) {
fault_instruction = (fault_instruction << 16)
@@ -342,7 +342,7 @@
curcpu()->ci_data.cpu_ntrap++;
#ifdef THUMB_CODE
- if ((frame->tf_spsr & PSR_T_bit) && !CPU_IS_ARMV7_P()) {
+ if ((tf->tf_spsr & PSR_T_bit) && !CPU_IS_ARMV7_P()) {
coprocessor = THUMB_UNKNOWN_HANDLER;
}
else
@@ -364,7 +364,7 @@
&& (fault_instruction & 0xf0000000) != 0xf0000000) {
coprocessor = (fault_instruction >> 8) & 0x0f;
#ifdef THUMB_CODE
- } else if ((frame->tf_spsr & PSR_T_bit) && !CPU_IS_ARMV7_P()) {
+ } else if ((tf->tf_spsr & PSR_T_bit) && !CPU_IS_ARMV7_P()) {
coprocessor = THUMB_UNKNOWN_HANDLER;
#endif
} else {
@@ -378,13 +378,13 @@
* time of fault.
*/
fault_code = FAULT_USER;
- lwp_settrapframe(l, frame);
+ lwp_settrapframe(l, tf);
} else
fault_code = 0;
/* OK this is were we do something about the instruction. */
LIST_FOREACH(uh, &undefined_handlers[coprocessor], uh_link)
- if (uh->uh_handler(fault_pc, fault_instruction, frame,
+ if (uh->uh_handler(fault_pc, fault_instruction, tf,
fault_code) == 0)
break;
@@ -415,10 +415,11 @@
if ((fault_code & FAULT_USER) == 0) {
#ifdef DDB
- db_printf("Undefined instruction in kernel\n");
- kdb_trap(T_FAULT, frame);
+ db_printf("Undefined instruction %#x in kernel at %#lx (LR %#x SP %#x)\n",
+ fault_instruction, fault_pc, tf->tf_svc_lr, tf->tf_svc_sp);
+ kdb_trap(T_FAULT, tf);
#else
- panic("undefined instruction in kernel");
+ panic("undefined instruction %#x in kernel at %#lx", fault_instruction, fault_pc);
#endif
}
KSI_INIT_TRAP(&ksi);
Home |
Main Index |
Thread Index |
Old Index