PERFORCE change 135393 for review
Randall R. Stewart
rrs at FreeBSD.org
Thu Feb 14 10:47:40 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=135393
Change 135393 by rrs at rrs-mips2-jnpr on 2008/02/14 18:46:43
Adds M_CHECK handler in trap()
Affected files ...
.. //depot/projects/mips2-jnpr/src/sys/mips/mips/trap.c#12 edit
Differences ...
==== //depot/projects/mips2-jnpr/src/sys/mips/mips/trap.c#12 (text+ko) ====
@@ -38,7 +38,6 @@
* from: @(#)trap.c 8.5 (Berkeley) 1/11/94
* JNPR: trap.c,v 1.13.2.2 2007/08/29 10:03:49 girish
*/
-
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -96,10 +95,9 @@
#include <sys/cdefs.h>
#include <sys/syslog.h>
-#define TRAP_DEBUG 0
-#if TRAP_DEBUG
-int trap_debug = 0;
+#ifdef TRAP_DEBUG
+int trap_debug = 1;
#endif
extern unsigned onfault_table[];
@@ -115,7 +113,7 @@
static void log_bad_page_fault(char *, struct trapframe *, int);
static void log_frame_dump(struct trapframe *frame);
static void get_mapping_info(vm_offset_t, pd_entry_t **, pt_entry_t **);
-#if TRAP_DEBUG
+#ifdef TRAP_DEBUG
static void trap_frame_dump(struct trapframe *frame);
#endif
extern char edata[];
@@ -342,7 +340,7 @@
disableintr();
}
-#if TRAP_DEBUG
+#ifdef TRAP_DEBUG
if (trap_debug) {
static vm_offset_t last_badvaddr = 0;
static vm_offset_t this_badvaddr = 0;
@@ -361,7 +359,7 @@
printf("cpuid = %d\n", PCPU_GET(cpuid));
#endif
MachTLBGetPID(pid);
- printf("badaddr = %p, pc = %p, ra = %p, sp = %p, sr = 0x%x, pid = %d, ASID = 0x%x\n",
+ printf("badaddr = %p, pc = %p, ra = %p, sp = %p, sr = 0x%x, pid = %d, ASID = 0x%x\n",
trapframe->badvaddr, trapframe->pc, trapframe->ra,
trapframe->sp, trapframe->sr,
(curproc ? curproc->p_pid : -1), pid);
@@ -395,6 +393,12 @@
#endif
switch (type) {
+ case T_MCHECK:
+#ifdef DDB
+ kdb_trap(type, 0, trapframe);
+#endif
+ panic("MCHECK\n");
+ break;
case T_TLB_MOD:
/* check for kernel address */
if (KERNLAND(trapframe->badvaddr)) {
@@ -557,9 +561,9 @@
--p->p_lock;
PROC_UNLOCK(p);
#ifdef VMFAULT_TRACE
- printf("vm_fault(%x (pmap %x), %x (%x), %x, %d) -> %x at pc %x\n",
- map, &vm->vm_pmap, va, trapframe->badvaddr, ftype, flag,
- rv, trapframe->pc);
+ printf("vm_fault(%x (pmap %x), %x (%x), %x, %d) -> %x at pc %x\n",
+ map, &vm->vm_pmap, va, trapframe->badvaddr, ftype, flag,
+ rv, trapframe->pc);
#endif
if (rv == KERN_SUCCESS) {
@@ -588,10 +592,6 @@
case T_ADDR_ERR_LD+T_USER: /* misaligned or kseg access */
case T_ADDR_ERR_ST+T_USER: /* misaligned or kseg access */
-#if TRAP_DEBUG
- printf("+++ ADDR_ERR+USER: type = %d, badvaddr = %x\n", type,
- trapframe->badvaddr);
-#endif
if (allow_unaligned_acc) {
int mode;
@@ -654,7 +654,7 @@
tpc = trapframe->pc; /* Remember if restart */
if (DELAYBRANCH(trapframe->cause)) { /* Check BD bit */
locr0->pc = MipsEmulateBranch(locr0, trapframe->pc, 0,
- 0);
+ 0);
} else {
locr0->pc += sizeof(int);
}
@@ -695,10 +695,10 @@
args[3] = locr0->a3;
nsaved = 4;
}
-
#if TRAP_DEBUG
printf("SYSCALL #%d pid:%u\n", code, p->p_pid);
#endif
+
if (p->p_sysent->sv_mask)
code &= p->p_sysent->sv_mask;
@@ -752,7 +752,6 @@
locr0 = td->td_frame;
#endif
trapdebug_enter(locr0, -code);
-
switch (i) {
case 0:
if (quad_syscall && code != SYS_lseek) {
@@ -951,7 +950,7 @@
case T_ADDR_ERR_LD: /* misaligned access */
case T_ADDR_ERR_ST: /* misaligned access */
-#if TRAP_DEBUG
+#ifdef TRAP_DEBUG
printf("+++ ADDR_ERR: type = %d, badvaddr = %x\n", type,
trapframe->badvaddr);
#endif
@@ -1007,7 +1006,7 @@
else
printf("kernel mode)\n");
-#if TRAP_DEBUG
+#ifdef TRAP_DEBUG
printf("badvaddr = %p, pc = %p, ra = %p, sr = 0x%x\n",
trapframe->badvaddr, trapframe->pc, trapframe->ra,
trapframe->sr);
@@ -1554,7 +1553,7 @@
#endif
}
-#if TRAP_DEBUG
+#ifdef TRAP_DEBUG
static void
trap_frame_dump(struct trapframe *frame)
{
More information about the p4-projects
mailing list