From patchwork Mon Apr 28 13:12: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: 4077341 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B3DDBBFF02 for ; Mon, 28 Apr 2014 13:15:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B0B2C2021B for ; Mon, 28 Apr 2014 13:15:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A6B42202E5 for ; Mon, 28 Apr 2014 13:15:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WelMZ-0002Pi-GN; Mon, 28 Apr 2014 13:12:51 +0000 Received: from mail-ee0-f50.google.com ([74.125.83.50]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WelMX-0002EB-65 for linux-arm-kernel@lists.infradead.org; Mon, 28 Apr 2014 13:12:49 +0000 Received: by mail-ee0-f50.google.com with SMTP id c13so4818183eek.23 for ; Mon, 28 Apr 2014 06:12:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SEqj9IYRdM/bxo9q1ywOGuvyl6d4AuBv1WI7/Ybe4Z4=; b=hRTGCGh8JJPk3mEVnf9NQvfUJdbStJOmG12R7DfiDBprk/kz7p9RVnCPZKCuJo5zjA Ad/LuZyNU4NyD4p9fJADfg4To5w8LQgkXFAV4su/mA8UgZ6jcu9x3xt1dF+Pf8VTKG07 5yXahKX6an5fC4h//x3vX3xzWEBjVWash5r/uZJ2Q7bUFfVAjn4TE3KXL2N5yzhhOnUW HkvhE/5VtNBC57BVxTxUi3Nl4wg1nDvNDSOHmoOL82D3AmxgbvsbvnbiyJFHZ+Rem//k PAQNmHn2s6C5NMnc88ZKC1ieWD211Hr8i6nfZvLJSu0pYYhE6LviV4g8gXqy1WDM6CDu b3uw== X-Gm-Message-State: ALoCoQlacGxbwVI85zvHBUqa8KYh0nTkFn/v17AURU+vdqf1hrgz2iBs2RIIf1T/69k0w1RWQaJz X-Received: by 10.14.211.133 with SMTP id w5mr32922301eeo.5.1398690746850; Mon, 28 Apr 2014 06:12:26 -0700 (PDT) Received: from localhost.localdomain ([109.139.146.108]) by mx.google.com with ESMTPSA id a42sm50299360ees.10.2014.04.28.06.12.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 28 Apr 2014 06:12:26 -0700 (PDT) From: Jean Pihet To: Will Deacon Subject: [PATCH 1/3] perf tests: Introduce perf_regs_load function on ARM64 Date: Mon, 28 Apr 2014 15:12:10 +0200 Message-Id: <1398690730-5454-1-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140428_061249_385206_CACD17DC X-CRM114-Status: GOOD ( 17.91 ) X-Spam-Score: -0.7 (/) Cc: Arnaldo Carvalho de Melo , linaro-kernel@lists.linaro.org, Steve Capper , Peter Zijlstra , patches@linaro.org, Frederic Weisbecker , Corey Ashford , linux-kernel@vger.kernel.org, Paul Mackerras , Arnaldo Carvalho de Melo , David Ahern , Namhyung Kim , Jean Pihet , Jiri Olsa , Ingo Molnar , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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, as expected by the perf built-in unwinding test. Signed-off-by: Jean Pihet Cc: Steve Capper 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/arm64/Makefile | 1 + tools/perf/arch/arm64/include/perf_regs.h | 2 ++ tools/perf/arch/arm64/tests/regs_load.S | 40 +++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 tools/perf/arch/arm64/tests/regs_load.S diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile index 67e9b3d..9b8f87e 100644 --- a/tools/perf/arch/arm64/Makefile +++ b/tools/perf/arch/arm64/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/arm64/include/perf_regs.h b/tools/perf/arch/arm64/include/perf_regs.h index 2359546..1e052f1 100644 --- a/tools/perf/arch/arm64/include/perf_regs.h +++ b/tools/perf/arch/arm64/include/perf_regs.h @@ -9,6 +9,8 @@ #define PERF_REG_IP PERF_REG_ARM64_PC #define PERF_REG_SP PERF_REG_ARM64_SP +void perf_regs_load(u64 *regs); + static inline const char *perf_reg_name(int id) { switch (id) { diff --git a/tools/perf/arch/arm64/tests/regs_load.S b/tools/perf/arch/arm64/tests/regs_load.S new file mode 100644 index 0000000..40b8b99 --- /dev/null +++ b/tools/perf/arch/arm64/tests/regs_load.S @@ -0,0 +1,40 @@ +#include + +/* + * 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, e.g. an address + * within the caller: + * - 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 current SP (not touched by this function), + * - the current value of LR is merely retrieved and stored because the + * value before the call to this function is unknown at this time; it will + * be unwound from the dwarf information in unwind__get_entries. + */ + +.text +.type perf_regs_load,%function +ENTRY(perf_regs_load) + stp x0, x1, [x0], #16 // store x0..x29 + stp x2, x3, [x0], #16 + stp x4, x5, [x0], #16 + stp x6, x7, [x0], #16 + stp x8, x9, [x0], #16 + stp x10, x11, [x0], #16 + stp x12, x13, [x0], #16 + stp x14, x15, [x0], #16 + stp x16, x17, [x0], #16 + stp x18, x19, [x0], #16 + stp x20, x21, [x0], #16 + stp x22, x23, [x0], #16 + stp x24, x25, [x0], #16 + stp x26, x27, [x0], #16 + stp x28, x29, [x0], #16 + mov x1, sp + stp x30, x1, [x0], #16 // store lr and sp + str x30, [x0] // store lr as the PC in order to skip the call + // to this function + ret +ENDPROC(perf_regs_load)