From patchwork Tue Aug 26 14:13:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 36028 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AD9E22054F for ; Tue, 26 Aug 2014 14:15:29 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id b6sf50708148yha.9 for ; Tue, 26 Aug 2014 07:15:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=Y8Es4NQZXhdrTZWS1BBn9vf7NnWVFUC93Pwtkg85cVY=; b=L7DQpAyRw7AS6ZmFyKMCkJM4FrnV4eqWzqsgqwbWW3147luj0llUX4xYRE4dBGH6Bz glbcFDzk9DesdQEM7b2gHefQ8VqV/CpYu1psEjfAPBUoxVm7C2uSwciy24VSUQvgrxcG GKWvbAfGEg4d3S35KEPeDPLuyyY6AO+nej+7axfZBG3peAJWkzNdy9HmvDWlPbBSRcfo eCeuK7YbByD4OZAopO8YqIaaeDxdrxSGO+pvHh4Ti/AZFsVOnkeDAVXPFttjOKwyCA6v VRbZjq8HnI4iMrtTP/FxC01SIauUtvV8QfEGDbuEXEP1O8oA+r/pEcfaa82gqtn4b6XQ uGbg== X-Gm-Message-State: ALoCoQlwLetxjYMOtrHksX1yuXKcv3/t7pT1rtpB3vvD+XhUWD217Pva3lBmzM5mH8ZU905R9ZU9 X-Received: by 10.224.45.131 with SMTP id e3mr18354024qaf.1.1409062529512; Tue, 26 Aug 2014 07:15:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.32.138 with SMTP id h10ls1127542qgh.87.gmail; Tue, 26 Aug 2014 07:15:29 -0700 (PDT) X-Received: by 10.236.123.228 with SMTP id v64mr41863842yhh.41.1409062529318; Tue, 26 Aug 2014 07:15:29 -0700 (PDT) Received: from mail-yh0-f48.google.com (mail-yh0-f48.google.com [209.85.213.48]) by mx.google.com with ESMTPS id u35si2476262yhp.174.2014.08.26.07.15.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Aug 2014 07:15:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.213.48 as permitted sender) client-ip=209.85.213.48; Received: by mail-yh0-f48.google.com with SMTP id i57so11767032yha.21 for ; Tue, 26 Aug 2014 07:15:29 -0700 (PDT) X-Received: by 10.52.129.200 with SMTP id ny8mr1283627vdb.27.1409062529202; Tue, 26 Aug 2014 07:15:29 -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.221.45.67 with SMTP id uj3csp202729vcb; Tue, 26 Aug 2014 07:15:28 -0700 (PDT) X-Received: by 10.68.215.67 with SMTP id og3mr37825250pbc.30.1409062527612; Tue, 26 Aug 2014 07:15:27 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id tb4si4740126pbc.57.2014.08.26.07.15.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Aug 2014 07:15:27 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; 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 1XMHVu-00010r-HO; Tue, 26 Aug 2014 14:14:22 +0000 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XMHVE-0008Au-VP for linux-arm-kernel@lists.infradead.org; Tue, 26 Aug 2014 14:13:42 +0000 Received: from edgewater-inn.cambridge.arm.com (edgewater-inn.cambridge.arm.com [10.1.203.34]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id s7QEDIwo011810; Tue, 26 Aug 2014 15:13:19 +0100 (BST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id E58351AE01EA; Tue, 26 Aug 2014 15:13:37 +0100 (BST) From: Will Deacon To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 11/11] arm64: perf: don't rely on layout of pt_regs when grabbing sp or pc Date: Tue, 26 Aug 2014 15:13:30 +0100 Message-Id: <1409062410-25891-12-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.0.rc1 In-Reply-To: <1409062410-25891-1-git-send-email-will.deacon@arm.com> References: <1409062410-25891-1-git-send-email-will.deacon@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140826_071341_423057_46B418C7 X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.0 (-----) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-5.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.96.50 listed in list.dnswl.org] 0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: catalin.marinas@arm.com, Jean Pihet , Will Deacon X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: will.deacon@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.213.48 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 The current perf_regs code relies on sp and pc sitting just off the end of the pt_regs->regs array. This is ugly and fragile, so this patch checks for these register explicitly and returns the appropriate field. Cc: Jean Pihet Signed-off-by: Will Deacon Acked-by: Jean Pihet --- arch/arm64/kernel/perf_regs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c index 422ebd63b619..6762ad705587 100644 --- a/arch/arm64/kernel/perf_regs.c +++ b/arch/arm64/kernel/perf_regs.c @@ -24,6 +24,12 @@ u64 perf_reg_value(struct pt_regs *regs, int idx) return regs->compat_lr; } + if ((u32)idx == PERF_REG_ARM64_SP) + return regs->sp; + + if ((u32)idx == PERF_REG_ARM64_PC) + return regs->pc; + return regs->regs[idx]; }