From owner-svn-src-all@freebsd.org Tue Feb 28 04:31:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9A29CF090B; Tue, 28 Feb 2017 04:31:29 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9042C8E0; Tue, 28 Feb 2017 04:31:29 +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 v1S4VSin044441; Tue, 28 Feb 2017 04:31:28 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1S4VSE2044440; Tue, 28 Feb 2017 04:31:28 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201702280431.v1S4VSE2044440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 28 Feb 2017 04:31:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314371 - head/sys/powerpc/powerpc 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.23 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: Tue, 28 Feb 2017 04:31:30 -0000 Author: jhibbits Date: Tue Feb 28 04:31:28 2017 New Revision: 314371 URL: https://svnweb.freebsd.org/changeset/base/314371 Log: Make kernel breakpoints work for book-e Add the necessary bits to enable kernel breakpoints for Book-E. The entrypoint for program exception is very trivial, so rather than expand it to be similar to AIM, add it into the standard trap handler. This wasn't blocked out as Book-E specific because it is only a minor redundancy over AIM, which should have already called db_trap_glue() at this point. If it's going to panic with a fatal trap anywya, it doesn't matter if it goes through this path again. Modified: head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Tue Feb 28 04:13:20 2017 (r314370) +++ head/sys/powerpc/powerpc/trap.c Tue Feb 28 04:31:28 2017 (r314371) @@ -97,6 +97,10 @@ static int handle_user_slb_spill(pmap_t extern int n_slbs; #endif +#ifdef KDB +int db_trap_glue(struct trapframe *); /* Called from trap_subr.S */ +#endif + struct powerpc_exception { u_int vector; char *name; @@ -338,9 +342,13 @@ trap(struct trapframe *frame) KASSERT(cold || td->td_ucred != NULL, ("kernel trap doesn't have ucred")); switch (type) { -#ifdef KDTRACE_HOOKS case EXC_PGM: +#ifdef KDTRACE_HOOKS +#ifdef AIM if (frame->srr1 & EXC_PGM_TRAP) { +#else + if (frame->cpu.booke.esr & ESR_PTR) { +#endif if (*(uint32_t *)frame->srr0 == EXC_DTRACE) { if (dtrace_invop_jump_addr != NULL) { dtrace_invop_jump_addr(frame); @@ -348,8 +356,12 @@ trap(struct trapframe *frame) } } } - break; #endif +#ifdef KDB + if (db_trap_glue(frame)) + return; +#endif + break; #if defined(__powerpc64__) && defined(AIM) case EXC_DSE: if ((frame->dar & SEGMENT_MASK) == USER_ADDR) { @@ -833,11 +845,10 @@ fix_unaligned(struct thread *td, struct } #ifdef KDB -int db_trap_glue(struct trapframe *); /* Called from trap_subr.S */ - int db_trap_glue(struct trapframe *frame) { + if (!(frame->srr1 & PSL_PR) && (frame->exc == EXC_TRC || frame->exc == EXC_RUNMODETRC #ifdef AIM @@ -845,6 +856,7 @@ db_trap_glue(struct trapframe *frame) && (frame->srr1 & EXC_PGM_TRAP)) #else || (frame->exc == EXC_DEBUG) + || (frame->cpu.booke.esr & ESR_PTR) #endif || frame->exc == EXC_BPT || frame->exc == EXC_DSI)) { @@ -856,7 +868,8 @@ db_trap_glue(struct trapframe *frame) #ifdef AIM if (type == EXC_PGM && (frame->srr1 & EXC_PGM_TRAP)) { #else - if (frame->cpu.booke.esr & ESR_PTR) { + if (type == EXC_DEBUG || + (frame->cpu.booke.esr & ESR_PTR)) { #endif type = T_BREAKPOINT; }