From owner-svn-src-all@freebsd.org Wed Feb 21 03:34:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6602CF26643; Wed, 21 Feb 2018 03:34:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0F7EE82225; Wed, 21 Feb 2018 03:34:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06FF613148; Wed, 21 Feb 2018 03:34:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L3YXAo070815; Wed, 21 Feb 2018 03:34:33 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L3YXV5070814; Wed, 21 Feb 2018 03:34:33 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201802210334.w1L3YXV5070814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 21 Feb 2018 03:34:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329695 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 329695 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 03:34:34 -0000 Author: jhibbits Date: Wed Feb 21 03:34:33 2018 New Revision: 329695 URL: https://svnweb.freebsd.org/changeset/base/329695 Log: Split printtrap() into generic and CPU-specific components Summary: This compartmentalizes the CPU-specific trap components into its own function, rather than littering the general printtrap() with various checks. This will let us replace a series of #ifdef's with a runtime conditional check in the future. Reviewed By: nwhitehorn Differential Revision: https://reviews.freebsd.org/D14416 Modified: head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Wed Feb 21 03:08:47 2018 (r329694) +++ head/sys/powerpc/powerpc/trap.c Wed Feb 21 03:34:33 2018 (r329695) @@ -445,52 +445,65 @@ trap_fatal(struct trapframe *frame) } static void -printtrap(u_int vector, struct trapframe *frame, int isfatal, int user) +cpu_printtrap(u_int vector, struct trapframe *frame, int isfatal, int user) { +#ifdef AIM uint16_t ver; -#ifdef BOOKE - vm_paddr_t pa; -#endif - printf("\n"); - printf("%s %s trap:\n", isfatal ? "fatal" : "handled", - user ? "user" : "kernel"); - printf("\n"); - printf(" exception = 0x%x (%s)\n", vector, trapname(vector)); switch (vector) { case EXC_DSE: case EXC_DSI: case EXC_DTMISS: - printf(" virtual address = 0x%" PRIxPTR "\n", frame->dar); -#ifdef AIM printf(" dsisr = 0x%lx\n", (u_long)frame->cpu.aim.dsisr); -#endif break; - case EXC_ISE: - case EXC_ISI: - case EXC_ITMISS: - printf(" virtual address = 0x%" PRIxPTR "\n", frame->srr0); - break; case EXC_MCHK: ver = mfpvr() >> 16; -#if defined(AIM) if (MPC745X_P(ver)) printf(" msssr0 = 0x%b\n", (int)mfspr(SPR_MSSSR0), MSSSR_BITMASK); + break; + } #elif defined(BOOKE) + vm_paddr_t pa; + + switch (vector) { + case EXC_MCHK: pa = mfspr(SPR_MCARU); pa = (pa << 32) | (u_register_t)mfspr(SPR_MCAR); printf(" mcsr = 0x%b\n", (int)mfspr(SPR_MCSR), MCSR_BITMASK); printf(" mcar = 0x%jx\n", (uintmax_t)pa); -#endif - break; } -#ifdef BOOKE printf(" esr = 0x%b\n", (int)frame->cpu.booke.esr, ESR_BITMASK); #endif +} + +static void +printtrap(u_int vector, struct trapframe *frame, int isfatal, int user) +{ + + printf("\n"); + printf("%s %s trap:\n", isfatal ? "fatal" : "handled", + user ? "user" : "kernel"); + printf("\n"); + printf(" exception = 0x%x (%s)\n", vector, trapname(vector)); + switch (vector) { + case EXC_DSE: + case EXC_DSI: + case EXC_DTMISS: + printf(" virtual address = 0x%" PRIxPTR "\n", frame->dar); + break; + case EXC_ISE: + case EXC_ISI: + case EXC_ITMISS: + printf(" virtual address = 0x%" PRIxPTR "\n", frame->srr0); + break; + case EXC_MCHK: + break; + } + cpu_printtrap(vector, frame, isfatal, user); printf(" srr0 = 0x%" PRIxPTR " (0x%" PRIxPTR ")\n", frame->srr0, frame->srr0 - (register_t)(__startkernel - KERNBASE)); printf(" srr1 = 0x%lx\n", (u_long)frame->srr1);