From owner-p4-projects@FreeBSD.ORG Sat May 20 19:14:24 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3AE0F16A421; Sat, 20 May 2006 19:14:24 +0000 (UTC) X-Original-To: perforce@freebsd.org 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 C187A16A41F for ; Sat, 20 May 2006 19:14:23 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 894B443D45 for ; Sat, 20 May 2006 19:14:23 +0000 (GMT) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k4KJDm2H086788 for ; Sat, 20 May 2006 19:13:48 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k4KJDmn2086785 for perforce@freebsd.org; Sat, 20 May 2006 19:13:48 GMT (envelope-from kmacy@freebsd.org) Date: Sat, 20 May 2006 19:13:48 GMT Message-Id: <200605201913.k4KJDmn2086785@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 97528 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 May 2006 19:14:24 -0000 http://perforce.freebsd.org/chv.cgi?CH=97528 Change 97528 by kmacy@kmacy_storage:sun4v_rwbuf on 2006/05/20 19:12:50 minor updates for new traps and some added debug output Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/trap.c#9 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/trap.c#9 (text+ko) ==== @@ -170,6 +170,8 @@ "restore physical watchpoint", "restore virtual watchpoint", "kernel stack fault", + "resumable error", + "nonresumable error" }; const int trap_sig[] = { @@ -207,7 +209,8 @@ SIGILL, /* trap instruction 29 */ SIGILL, /* trap instruction 30 */ SIGILL, /* trap instruction 31 */ - SIGSEGV, /* fast instruction access mmu miss */ + SIGSEGV, /* floating point not implemented */ + /* should be SIGFPE but other signals currently cause problems */ SIGSEGV, /* fast data access mmu miss */ -1, /* interrupt */ -1, /* physical address watchpoint */ @@ -245,12 +248,14 @@ set_wstate(WSTATE_KERN); set_mmfsa_scratchpad(mmfsa); + init_mondo_queue(); OF_set_mmfsa_traptable(&tl0_base, mmfsa); for (i = 0; i < 128; i++) trap_conversion[i] = i; for (i = 128; i < 256; i++) trap_conversion[i] = 0; trap_conversion[0x31] = 35; + trap_conversion[0x34] = 15; trap_conversion[0x9] = 34; trap_conversion[0x6c] = 14; @@ -263,6 +268,7 @@ struct proc *p; int error; int sig; + register_t addr; ksiginfo_t ksi; td = PCPU_GET(curthread); @@ -280,12 +286,14 @@ p = td->td_proc; td->td_pticks = 0; td->td_frame = tf; + addr = tf->tf_tpc; if (td->td_ucred != p->p_ucred) cred_update_thread(td); switch (type) { case T_DATA_MISS: case T_DATA_PROTECTION: + addr = TLB_TAR_VA(data); case T_INSTRUCTION_MISS: sig = trap_pfault(td, tf, type, data); break; @@ -315,11 +323,17 @@ if (debugger_on_signal && (sig == 4 || sig == 10 || sig == 11)) kdb_enter("trapsig"); + if (sig == 4 || sig == 10 || sig == 11) + printf("trap: %ld:%s: 0x%lx at 0x%lx on cpu=%d sig=%d\n", type, + trap_msg[trap_conversion[type]], data, tf->tf_tpc, curcpu, sig); + /* XXX I've renumbered the traps to largely reflect what the hardware uses + * so this will need to be re-visited + */ ksiginfo_init_trap(&ksi); ksi.ksi_signo = sig; - ksi.ksi_code = (int)type; /* XXX not POSIX */ - /* ksi.ksi_addr = ? */ - ksi.ksi_trapno = (int)type; + ksi.ksi_code = (int)trap_conversion[type]; /* XXX not POSIX */ + ksi.ksi_addr = (void *)addr; + ksi.ksi_trapno = (int)trap_conversion[type]; trapsignal(td, &ksi); } @@ -350,6 +364,10 @@ error = trap_pfault(td, tf, type, data); break; case T_DATA_EXCEPTION: + printf("data exception on 0x%lx at 0x%lx\n", data, tf->tf_tpc); + printf("trap: %ld=%s: 0x%lx at 0x%lx:0x%lx\n", type & ~T_KERNEL, trap_msg[trap_conversion[type & ~T_KERNEL]], data, tf->tf_tpc, tf->tf_tnpc); + error = 1; + break; case T_MEM_ADDRESS_NOT_ALIGNED: #ifdef notyet if ((tf->tf_sfsr & MMU_SFSR_FV) != 0 && @@ -388,7 +406,7 @@ } if (error != 0) - panic("trap: %s at 0x%lx", trap_msg[trap_conversion[type & ~T_KERNEL]], tf->tf_tpc); + panic("trap: %ld=%s: 0x%lx at 0x%lx:0x%lx error=%d", type & ~T_KERNEL, trap_msg[trap_conversion[type & ~T_KERNEL]], data, tf->tf_tpc, tf->tf_tnpc, error); } CTR1(KTR_TRAP, "trap: td=%p return", td); }