From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 20:54:35 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2A698AC1; Sat, 29 Nov 2014 20:54:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BA495E6; Sat, 29 Nov 2014 20:54:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATKsYOW005822; Sat, 29 Nov 2014 20:54:34 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATKsXc4005812; Sat, 29 Nov 2014 20:54:33 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201411292054.sATKsXc4005812@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 29 Nov 2014 20:54:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275268 - in head/sys/powerpc: aim include X-SVN-Group: head 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.18-1 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: Sat, 29 Nov 2014 20:54:35 -0000 Author: jhibbits Date: Sat Nov 29 20:54:33 2014 New Revision: 275268 URL: https://svnweb.freebsd.org/changeset/base/275268 Log: Add support for dtrace:fbt on modules for PowerPC Summary: Revert the initial FBT-with-KDB changes for trap_subr*.S, and instead use the db_trap filter function to handle dtrace trap filtering. With this, the MMU is enabled by the support code, simplifying the codepath altogether. Test Plan: Tested on my G4 PowerBook Reviewers: #powerpc, nwhitehorn Reviewed By: nwhitehorn Differential Revision: https://reviews.freebsd.org/D1207 MFC after: 3 weeks Modified: head/sys/powerpc/aim/machdep.c head/sys/powerpc/aim/trap.c head/sys/powerpc/aim/trap_subr32.S head/sys/powerpc/aim/trap_subr64.S head/sys/powerpc/include/trap.h Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Sat Nov 29 20:24:18 2014 (r275267) +++ head/sys/powerpc/aim/machdep.c Sat Nov 29 20:54:33 2014 (r275268) @@ -757,6 +757,10 @@ db_trap_glue(struct trapframe *frame) || frame->exc == EXC_BPT || frame->exc == EXC_DSI)) { int type = frame->exc; + + /* Ignore DTrace traps. */ + if (*(uint32_t *)frame->srr0 == EXC_DTRACE) + return (0); if (type == EXC_PGM && (frame->srr1 & 0x20000)) { type = T_BREAKPOINT; } Modified: head/sys/powerpc/aim/trap.c ============================================================================== --- head/sys/powerpc/aim/trap.c Sat Nov 29 20:24:18 2014 (r275267) +++ head/sys/powerpc/aim/trap.c Sat Nov 29 20:54:33 2014 (r275268) @@ -258,7 +258,8 @@ trap(struct trapframe *frame) if (frame->srr1 & EXC_PGM_TRAP) { #ifdef KDTRACE_HOOKS inst = fuword32((const void *)frame->srr0); - if (inst == 0x0FFFDDDD && dtrace_pid_probe_ptr != NULL) { + if (inst == 0x0FFFDDDD && + dtrace_pid_probe_ptr != NULL) { struct reg regs; fill_regs(td, ®s); (*dtrace_pid_probe_ptr)(®s); @@ -301,7 +302,7 @@ trap(struct trapframe *frame) #ifdef KDTRACE_HOOKS case EXC_PGM: if (frame->srr1 & EXC_PGM_TRAP) { - if (*(uint32_t *)frame->srr0 == 0x7c810808) { + if (*(uint32_t *)frame->srr0 == EXC_DTRACE) { if (dtrace_invop_jump_addr != NULL) { dtrace_invop_jump_addr(frame); return; Modified: head/sys/powerpc/aim/trap_subr32.S ============================================================================== --- head/sys/powerpc/aim/trap_subr32.S Sat Nov 29 20:24:18 2014 (r275267) +++ head/sys/powerpc/aim/trap_subr32.S Sat Nov 29 20:54:33 2014 (r275268) @@ -890,8 +890,7 @@ CNAME(dblow): mfcr %r29 /* save CR in r29 */ mfsrr1 %r1 mtcr %r1 - bf 17,2f /* branch if privileged */ -1: + bf 17,1f /* branch if privileged */ /* Unprivileged case */ mtcr %r29 /* put the condition register back */ mfsprg2 %r29 /* ... and r29 */ @@ -900,19 +899,7 @@ CNAME(dblow): li %r1, 0 /* How to get the vector from LR */ bla generictrap /* and we look like a generic trap */ -2: -#ifdef KDTRACE_HOOKS - /* Privileged, so drop to KDB */ - mfsrr0 %r1 - mtsprg3 %r3 - lwz %r1,0(%r1) - /* Check if it's a DTrace trap. */ - li %r3,0x0808 - addis %r3,%r3,0x7c81 - cmplw %cr0,%r3,%r1 - mfsprg3 %r3 - beq %cr0,1b -#endif +1: /* Privileged, so drop to KDB */ GET_CPUINFO(%r1) stw %r28,(PC_DBSAVE+CPUSAVE_R28)(%r1) /* free r28 */ Modified: head/sys/powerpc/aim/trap_subr64.S ============================================================================== --- head/sys/powerpc/aim/trap_subr64.S Sat Nov 29 20:24:18 2014 (r275267) +++ head/sys/powerpc/aim/trap_subr64.S Sat Nov 29 20:54:33 2014 (r275268) @@ -799,9 +799,8 @@ CNAME(dblow): mfcr %r29 /* save CR in r29 */ mfsrr1 %r1 mtcr %r1 - bf 17,2f /* branch if privileged */ + bf 17,1f /* branch if privileged */ -1: /* Unprivileged case */ mtcr %r29 /* put the condition register back */ mfsprg2 %r29 /* ... and r29 */ @@ -810,19 +809,7 @@ CNAME(dblow): li %r1, 0 /* How to get the vector from LR */ bla generictrap /* and we look like a generic trap */ -2: -#ifdef KDTRACE_HOOKS - /* Privileged, so drop to KDB */ - mfsrr0 %r1 - mtsprg3 %r3 - lwz %r1,0(%r1) - /* Check if it's a DTrace trap. */ - li %r3,0x0808 - addis %r3,%r3,0x7c81 - cmplw %cr0,%r3,%r1 - mfsprg3 %r3 - beq %cr0,1b -#endif +1: GET_CPUINFO(%r1) std %r27,(PC_DBSAVE+CPUSAVE_R27)(%r1) /* free r27 */ std %r28,(PC_DBSAVE+CPUSAVE_R28)(%r1) /* free r28 */ Modified: head/sys/powerpc/include/trap.h ============================================================================== --- head/sys/powerpc/include/trap.h Sat Nov 29 20:24:18 2014 (r275267) +++ head/sys/powerpc/include/trap.h Sat Nov 29 20:54:33 2014 (r275268) @@ -120,6 +120,9 @@ #define EXC_PGM_PRIV (1UL << 18) #define EXC_PGM_TRAP (1UL << 17) +/* DTrace trap opcode. */ +#define EXC_DTRACE 0x7c810808 + #ifndef LOCORE struct trapframe; struct pcb;