From owner-svn-src-stable@FreeBSD.ORG Fri Mar 14 04:35:19 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D6025BF2; Fri, 14 Mar 2014 04:35:19 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A8B80B7F; Fri, 14 Mar 2014 04:35:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2E4ZJqa076319; Fri, 14 Mar 2014 04:35:19 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2E4ZJO1076318; Fri, 14 Mar 2014 04:35:19 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201403140435.s2E4ZJO1076318@svn.freebsd.org> From: Justin Hibbits Date: Fri, 14 Mar 2014 04:35:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r263151 - stable/10/sys/dev/hwpmc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Mar 2014 04:35:19 -0000 Author: jhibbits Date: Fri Mar 14 04:35:18 2014 New Revision: 263151 URL: http://svnweb.freebsd.org/changeset/base/263151 Log: MFC r262547 Fix callchain capture for hwpmc(4). While here, some style(9) fixes, too. Modified: stable/10/sys/dev/hwpmc/hwpmc_powerpc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hwpmc/hwpmc_powerpc.c ============================================================================== --- stable/10/sys/dev/hwpmc/hwpmc_powerpc.c Fri Mar 14 03:42:05 2014 (r263150) +++ stable/10/sys/dev/hwpmc/hwpmc_powerpc.c Fri Mar 14 04:35:18 2014 (r263151) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -60,10 +61,14 @@ pmc_save_kernel_callchain(uintptr_t *cc, cc[frames++] = PMC_TRAPFRAME_TO_PC(tf); sp = (uintptr_t *)PMC_TRAPFRAME_TO_FP(tf); - for (frames = 1; frames < maxsamples; frames++) { + for (; frames < maxsamples; frames++) { if (!INKERNEL(sp)) break; +#ifdef __powerpc64__ + cc[frames++] = sp[2]; +#else cc[frames++] = sp[1]; +#endif sp = (uintptr_t *)*sp; } return (frames); @@ -72,12 +77,14 @@ pmc_save_kernel_callchain(uintptr_t *cc, static int powerpc_switch_in(struct pmc_cpu *pc, struct pmc_process *pp) { + return (0); } static int powerpc_switch_out(struct pmc_cpu *pc, struct pmc_process *pp) { + return (0); } @@ -111,6 +118,7 @@ powerpc_describe(int cpu, int ri, struct int powerpc_get_config(int cpu, int ri, struct pmc **ppm) { + *ppm = powerpc_pcpu[cpu]->pc_ppcpmcs[ri].phw_pmc; return (0); @@ -182,11 +190,23 @@ pmc_save_user_callchain(uintptr_t *cc, i cc[frames++] = PMC_TRAPFRAME_TO_PC(tf); sp = (uintptr_t *)PMC_TRAPFRAME_TO_FP(tf); - for (frames = 1; frames < maxsamples; frames++) { + for (; frames < maxsamples; frames++) { if (!INUSER(sp)) break; - cc[frames++] = fuword(sp + 1); - sp = (uintptr_t *)fuword(sp); +#ifdef __powerpc64__ + /* Check if 32-bit mode. */ + if (!(tf->srr1 & PSL_SF)) { + cc[frames++] = fuword32((uint32_t *)sp + 1); + sp = (uintptr_t *)(uintptr_t)fuword32(sp); + } else { + cc[frames++] = fuword(sp + 2); + sp = (uintptr_t *)fuword(sp); + } +#else + cc[frames++] = fuword32((uint32_t *)sp + 1); + sp = (uintptr_t *)fuword32(sp); +#endif } + return (frames); }