From owner-p4-projects@FreeBSD.ORG Sun May 25 01:56:15 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1BA1837B404; Sun, 25 May 2003 01:56:15 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C543A37B401 for ; Sun, 25 May 2003 01:56:14 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4C6A643F3F for ; Sun, 25 May 2003 01:56:14 -0700 (PDT) (envelope-from jmallett@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h4P8uE0U056689 for ; Sun, 25 May 2003 01:56:14 -0700 (PDT) (envelope-from jmallett@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h4P8uDAW056686 for perforce@freebsd.org; Sun, 25 May 2003 01:56:13 -0700 (PDT) Date: Sun, 25 May 2003 01:56:13 -0700 (PDT) Message-Id: <200305250856.h4P8uDAW056686@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jmallett@freebsd.org using -f From: Juli Mallett To: Perforce Change Reviews Subject: PERFORCE change 31848 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 May 2003 08:56:16 -0000 http://perforce.freebsd.org/chv.cgi?CH=31848 Change 31848 by jmallett@jmallett_dalek on 2003/05/25 01:56:03 Mildly more interesting trap() output. Affected files ... .. //depot/projects/mips/sys/mips/mips/trap.c#3 edit Differences ... ==== //depot/projects/mips/sys/mips/mips/trap.c#3 (text+ko) ==== @@ -32,16 +32,72 @@ #include #include +struct trap_identifier { + u_int ExcCode; + const char *Mnemonic; + const char *Description; +} trap_ids[] = { + { 0, "Int", "Interrupt" }, + { 1, "Mod", "TLB modification" }, + { 2, "TLBL", "TLB (fetch" }, + { 3, "TLBS", "TLB (store)" }, + { 4, "AdEL", "Address error (fetch)" }, + { 5, "AdES", "Address error (store)" }, + { 6, "IBE", "Bus error (instruction)" }, + { 7, "DBE", "Bus error (data)" }, + { 8, "Sys", "System call" }, + { 9, "Bp", "Breakpoint" }, + { 10, "RI", "Reserved instruction" }, + { 11, "CpU", "Coprocessor unusable" }, + { 12, "Ov", "Arithmetic overflow" }, + { 13, "Tr", "Trap" }, + { 14, "VCEI", "Virtual coherency (instruction)" }, + { 15, "FPE", "Floating point" }, + { 16, NULL, NULL }, + { 17, NULL, NULL }, + { 18, NULL, NULL }, + { 19, NULL, NULL }, + { 20, NULL, NULL }, + { 21, NULL, NULL }, + { 22, NULL, NULL }, + { 23, "WATCH", "Watchpoint" }, + { 24, NULL, NULL }, + { 25, NULL, NULL }, + { 26, NULL, NULL }, + { 27, NULL, NULL }, + { 28, NULL, NULL }, + { 29, NULL, NULL }, + { 30, NULL, NULL }, + { 31, "VCED", "Virtual coherency (data)" } +}; +#define MAXTRAPID 31 + void trap(struct trapframe *tf, u_int cause, void *badvaddr) { + struct trap_identifier *tid; int code, kernelmode; code = (cause & MIPS3_CR_EXC_CODE) >> MIPS_CR_EXC_CODE_SHIFT; kernelmode = (tf->tf_regs[TF_SR] & MIPS_SR_KSU_USER) == 0; - printf("Fatal trap type %d in %s mode\n", + printf("\n\nFatal trap type %d in %s mode:", code, kernelmode ? "kernel" : "user"); - printf("EPC %lx, BadVAddr %p\n", tf->tf_regs[TF_EPC], badvaddr); + if (code <= MAXTRAPID && code >= 0) { + tid = &trap_ids[code]; + if (tid->Mnemonic != NULL) + printf(" (%s)", tid->Mnemonic); + if (tid->Description != NULL) + printf(" %s", tid->Description); + else + printf(" Reserved exception code"); + } else + printf(" (out of range)"); + printf("\n"); + printf(" program counter = %lx\n", tf->tf_regs[TF_EPC]); + printf(" return address = %lx\n", tf->tf_regs[TF_RA]); + printf("bad virtual address = %p\n", badvaddr); + printf(" cause = %x\n", cause); + printf(" status = %lx\n", tf->tf_regs[TF_SR]); if (panicstr != NULL) { printf("Double panic, resetting...\n"); cpu_reset();