From owner-p4-projects@FreeBSD.ORG Sat May 24 16:39:50 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 52F4737B404; Sat, 24 May 2003 16:39:50 -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 CF6B837B401 for ; Sat, 24 May 2003 16:39:49 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6C15D43F93 for ; Sat, 24 May 2003 16:39:49 -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 h4ONdn0U012738 for ; Sat, 24 May 2003 16:39:49 -0700 (PDT) (envelope-from jmallett@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h4ONdm0C012735 for perforce@freebsd.org; Sat, 24 May 2003 16:39:48 -0700 (PDT) Date: Sat, 24 May 2003 16:39:48 -0700 (PDT) Message-Id: <200305242339.h4ONdm0C012735@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 31828 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: Sat, 24 May 2003 23:39:51 -0000 http://perforce.freebsd.org/chv.cgi?CH=31828 Change 31828 by jmallett@jmallett_dalek on 2003/05/24 16:39:26 Beginnings of moving to new exception code. Right now it only provides the generic exception vector, and saves registers then restores them, jumping to trap() in between. This is enough to print out "Fatal trap ..." messages in a very minimal way. It resets on a double panic. (After printing (some) state.) Affected files ... .. //depot/projects/mips/sys/conf/files.mips#18 edit .. //depot/projects/mips/sys/mips/mips/genassym.c#8 edit .. //depot/projects/mips/sys/mips/mips/machdep.c#26 edit .. //depot/projects/mips/sys/mips/mips/trap.c#2 edit Differences ... ==== //depot/projects/mips/sys/conf/files.mips#18 (text+ko) ==== @@ -12,6 +12,7 @@ # This stanza is MIPS MD files. mips/mips/critical.c standard mips/mips/elf_machdep.c standard +mips/mips/exception.S standard mips/mips/locore.S standard no-obj mips/mips/locore_mips3.S standard mips/mips/machdep.c standard ==== //depot/projects/mips/sys/mips/mips/genassym.c#8 (text+ko) ==== @@ -148,6 +148,7 @@ ASSYM(TF_BASE, offsetof(struct kernframe, cf_frame)); +ASSYM(TF_SIZE, sizeof(struct trapframe)); ASSYM(TF_REG_AST, offsetof(struct trapframe, tf_regs[TF_AST])); ASSYM(TF_REG_V0, offsetof(struct trapframe, tf_regs[TF_V0])); ASSYM(TF_REG_V1, offsetof(struct trapframe, tf_regs[TF_V1])); ==== //depot/projects/mips/sys/mips/mips/machdep.c#26 (text+ko) ==== @@ -577,7 +577,7 @@ mips64_vector_init(void) { /* r4000 exception handler address and end */ - extern char mips64_exception[], mips64_exceptionEnd[]; + extern char ExceptionVector[], ExceptionVectorEnd[]; /* TLB miss handler address and end */ extern char mips64_TLBMiss[], mips64_TLBMissEnd[]; @@ -610,10 +610,10 @@ memcpy((void *)MIPS3_CACHE_ERR_EXC_VEC, mips64_cache, mips64_cacheEnd - mips64_cache); - if (mips64_exceptionEnd - mips64_exception > 0x80) + if (ExceptionVectorEnd - ExceptionVector > 0x80) panic("startup: General exception vector code too large"); - memcpy((void *)MIPS3_GEN_EXC_VEC, mips64_exception, - mips64_exceptionEnd - mips64_exception); + memcpy((void *)MIPS3_GEN_EXC_VEC, ExceptionVector, + ExceptionVectorEnd - ExceptionVector); #if 0 /* XXX - why doesn't mipsNN_intr() work? */ if (mips64_intrEnd - mips64_intr > 0x80) @@ -621,8 +621,8 @@ memcpy((void *)MIPS3_INTR_EXC_VEC, mips64_intr, mips64_intrEnd - mips64_intr); #else - memcpy((void *)MIPS3_INTR_EXC_VEC, mips64_exception, - mips64_exceptionEnd - mips64_exception); + memcpy((void *)MIPS3_INTR_EXC_VEC, ExceptionVector, + ExceptionVectorEnd - ExceptionVector); #endif /* ==== //depot/projects/mips/sys/mips/mips/trap.c#2 (text+ko) ==== @@ -30,9 +30,21 @@ #include #include +#include void -trap(unsigned status, unsigned cause, unsigned vaddr, unsigned opc, struct trapframe *fp) +trap(struct trapframe *tf, u_int cause, void *badvaddr) { - panic("trap!!"); + 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", + code, kernelmode ? "kernel" : "user"); + printf("EPC %lx, BadVAddr %p\n", tf->tf_regs[TF_EPC], badvaddr); + if (panicstr != NULL) { + printf("Double panic, resetting...\n"); + cpu_reset(); + } + panic("trap"); }