From patchwork Fri May 16 08:41:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 30312 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f198.google.com (mail-ie0-f198.google.com [209.85.223.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EE29A202E4 for ; Fri, 16 May 2014 08:41:52 +0000 (UTC) Received: by mail-ie0-f198.google.com with SMTP id tp5sf2042332ieb.9 for ; Fri, 16 May 2014 01:41:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=CmIvZKKr+deXEDGYWcv+bqXqgsFXFSfGTVCbjVN0EiU=; b=Qtxmx6wFpnwMc9FfvbsdpBJ17olxaS4oD2FotHTY59+ySKMFlohAktFYBAHmBfQ2Ao De/cdS54eIkzs7Ws7EYOFYahHjwW/4SPLF+YRFmDZXwWs85bKV+wBpxgBedUBoWUJzB9 HAeXPNZfEb82hadayyX9z3tNp9JT2GiFNHXqCb6o7pfmBrTkco7enEkIYVlICV2kS2/e q7C3KlFOTqSlQM2Yu1qTlCxpX2jPqEnJAiI/P7xMUtgRM5Lb97Osi6E8icDNfG0DEsbo epCn3EtJx03TUj+VREUxbY7pWxPxJVdcFPuZOgmapatf3JmtXcThGx+F/wPEiVqvaBeO zM+g== X-Gm-Message-State: ALoCoQlI+cAy3QO/wWoq8z2A5baDUKH7d5L9RZ9jnt9LFxyguQkATacZK9ldCygxKLWrGQ7n6w3t X-Received: by 10.182.213.37 with SMTP id np5mr7766136obc.36.1400229712454; Fri, 16 May 2014 01:41:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.104.49 with SMTP id z46ls632944qge.50.gmail; Fri, 16 May 2014 01:41:52 -0700 (PDT) X-Received: by 10.221.62.131 with SMTP id xa3mr4274436vcb.13.1400229712354; Fri, 16 May 2014 01:41:52 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id bz6si799446vdb.72.2014.05.16.01.41.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 May 2014 01:41:52 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id lg15so5777928vcb.21 for ; Fri, 16 May 2014 01:41:52 -0700 (PDT) X-Received: by 10.52.14.130 with SMTP id p2mr122864vdc.39.1400229712235; Fri, 16 May 2014 01:41:52 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp34194vcb; Fri, 16 May 2014 01:41:51 -0700 (PDT) X-Received: by 10.66.102.4 with SMTP id fk4mr18873889pab.59.1400229711232; Fri, 16 May 2014 01:41:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id lj7si8165614pab.179.2014.05.16.01.41.50; Fri, 16 May 2014 01:41:50 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756593AbaEPIle (ORCPT + 27 others); Fri, 16 May 2014 04:41:34 -0400 Received: from mail-ee0-f48.google.com ([74.125.83.48]:49556 "EHLO mail-ee0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754095AbaEPIl3 (ORCPT ); Fri, 16 May 2014 04:41:29 -0400 Received: by mail-ee0-f48.google.com with SMTP id e49so1287210eek.21 for ; Fri, 16 May 2014 01:41:27 -0700 (PDT) X-Received: by 10.14.211.133 with SMTP id w5mr20468840eeo.5.1400229687723; Fri, 16 May 2014 01:41:27 -0700 (PDT) Received: from localhost.localdomain (74.16-201-80.adsl-dyn.isp.belgacom.be. [80.201.16.74]) by mx.google.com with ESMTPSA id u1sm18410354eex.31.2014.05.16.01.41.25 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 16 May 2014 01:41:26 -0700 (PDT) From: Jean Pihet To: linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Will Deacon , Jiri Olsa , Ingo Molnar , Arnaldo Carvalho de Melo Cc: Jean Pihet , Corey Ashford , Frederic Weisbecker , Namhyung Kim , Paul Mackerras , Peter Zijlstra , Arnaldo Carvalho de Melo , David Ahern Subject: [PATCH 2/4] perf tests: Introduce perf_regs_load function on ARM Date: Fri, 16 May 2014 10:41:10 +0200 Message-Id: <1400229672-16104-2-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1400229672-16104-1-git-send-email-jean.pihet@linaro.org> References: <1400229672-16104-1-git-send-email-jean.pihet@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: jean.pihet@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Introducing perf_regs_load function, which is going to be used for dwarf unwind test in following patches. It takes single argument as a pointer to the regs dump buffer and populates it with current registers values. Signed-off-by: Jean Pihet Reviewed-by: Will Deacon Cc: Corey Ashford Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Arnaldo Carvalho de Melo Cc: David Ahern Cc: Jiri Olsa --- tools/perf/arch/arm/Makefile | 1 + tools/perf/arch/arm/include/perf_regs.h | 2 ++ tools/perf/arch/arm/tests/regs_load.S | 58 +++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 tools/perf/arch/arm/tests/regs_load.S diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile index 67e9b3d..9b8f87e 100644 --- a/tools/perf/arch/arm/Makefile +++ b/tools/perf/arch/arm/Makefile @@ -4,4 +4,5 @@ LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o endif ifndef NO_LIBUNWIND LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o endif diff --git a/tools/perf/arch/arm/include/perf_regs.h b/tools/perf/arch/arm/include/perf_regs.h index bcca511..33abcfa 100644 --- a/tools/perf/arch/arm/include/perf_regs.h +++ b/tools/perf/arch/arm/include/perf_regs.h @@ -5,6 +5,8 @@ #include #include +void perf_regs_load(u64 *regs); + #define PERF_REGS_MASK ((1ULL << PERF_REG_ARM_MAX) - 1) #define PERF_REG_IP PERF_REG_ARM_PC #define PERF_REG_SP PERF_REG_ARM_SP diff --git a/tools/perf/arch/arm/tests/regs_load.S b/tools/perf/arch/arm/tests/regs_load.S new file mode 100644 index 0000000..e09e983 --- /dev/null +++ b/tools/perf/arch/arm/tests/regs_load.S @@ -0,0 +1,58 @@ +#include + +#define R0 0x00 +#define R1 0x08 +#define R2 0x10 +#define R3 0x18 +#define R4 0x20 +#define R5 0x28 +#define R6 0x30 +#define R7 0x38 +#define R8 0x40 +#define R9 0x48 +#define SL 0x50 +#define FP 0x58 +#define IP 0x60 +#define SP 0x68 +#define LR 0x70 +#define PC 0x78 + +/* + * Implementation of void perf_regs_load(u64 *regs); + * + * This functions fills in the 'regs' buffer from the actual registers values, + * in the way the perf built-in unwinding test expects them: + * - the PC at the time at the call to this function. Since this function + * is called using a bl instruction, the PC value is taken from LR. + * The built-in unwinding test then unwinds the call stack from the dwarf + * information in unwind__get_entries. + * + * Notes: + * - the 8 bytes stride in the registers offsets comes from the fact + * that the registers are stored in an u64 array (u64 *regs), + * - the regs buffer needs to be zeroed before the call to this function, + * in this case using a calloc in dwarf-unwind.c. + */ + +.text +.type perf_regs_load,%function +ENTRY(perf_regs_load) + str r0, [r0, #R0] + str r1, [r0, #R1] + str r2, [r0, #R2] + str r3, [r0, #R3] + str r4, [r0, #R4] + str r5, [r0, #R5] + str r6, [r0, #R6] + str r7, [r0, #R7] + str r8, [r0, #R8] + str r9, [r0, #R9] + str sl, [r0, #SL] + str fp, [r0, #FP] + str ip, [r0, #IP] + str sp, [r0, #SP] + str lr, [r0, #LR] + str lr, [r0, #PC] // store pc as lr in order to skip the call + // to this function + mov pc, lr +ENDPROC(perf_regs_load)