From patchwork Fri Sep 6 21:28:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Behan Webster X-Patchwork-Id: 273340 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 654482C0117 for ; Sat, 7 Sep 2013 07:38:55 +1000 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VI3jf-0001wC-Ef; Fri, 06 Sep 2013 21:38:35 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VI3jd-0000kh-FL; Fri, 06 Sep 2013 21:38:33 +0000 Received: from mail-ie0-x235.google.com ([2607:f8b0:4001:c03::235]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VI3jZ-0000k7-Eq for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2013 21:38:30 +0000 Received: by mail-ie0-f181.google.com with SMTP id y16so2874854ieg.40 for ; Fri, 06 Sep 2013 14:38:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=converseincode.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=Gb3EmO2ydX2T2cEfEnI60wsSSTruv++/eIH4gPKdJY0=; b=DryJiCjX5iTd/s+sv3s1RcaQCZrmQXeYfHXFKPwHPYgbY+mICPDeUkN4KZo24Oamqh rfJnZMRvtHxvrGLBb42A48qwMwQsBMh6hXcvl2VEFEyRGKz2//1ZEiUKBXP/G3rIzpnK VLNRtFEjXgvTEUjp8UYpthba2buhwDHZiCDyc= 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:mime-version:content-type:content-transfer-encoding; bh=Gb3EmO2ydX2T2cEfEnI60wsSSTruv++/eIH4gPKdJY0=; b=G4pXdMKsQg/zg/WcHPbSq7BAJxinTRjMwLLz4PEF59XixwFeARp6490zQV8vgP7LUZ MDQPqZpONdsj2+XwYCwxDP8AC1hHAukPpmTmA1v4DDQtR2ZLWaCnsh8yns5+7+t7AMA8 HJGm9L6hGizD5s7z0YOutRgLwtH1QffaVMyWqkoOKhEMuVDUKkb8h8ircqQV23k4scLe np7x0G10gYCiNja3KvXJ/xUUGLbEhTLtn6BB+n1O+h4paFXYFSmXZw74wKAW3hzAulXQ kcKICKbEGYh20a8DjTL71B+XhUDDyyj4su4V40q6hT9eF0Bhl6owS6seY/Yq4wLLwwM+ GmKg== X-Gm-Message-State: ALoCoQm3AkVB22EsCWds5LnAzz+uN594xXgSd4qmgmp+QFcAdkQY9ZTpU/PRH8kT9jvkPgaLW4aL X-Received: by 10.42.126.18 with SMTP id c18mr340883ics.46.1378503039229; Fri, 06 Sep 2013 14:30:39 -0700 (PDT) Received: from galdor.websterwood.com (216-58-123-51.cpe.distributel.net. [216.58.123.51]) by mx.google.com with ESMTPSA id i1sm605871iga.0.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Sep 2013 14:30:38 -0700 (PDT) From: behanw@converseincode.com To: linux@arm.linux.org.uk Subject: [PATCH 1/5] arm: LLVMLinux: Add current_stack_pointer macro for ARM Date: Fri, 6 Sep 2013 17:28:07 -0400 Message-Id: <1378502899-1241-2-git-send-email-behanw@converseincode.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1378502899-1241-1-git-send-email-behanw@converseincode.com> References: <1378502899-1241-1-git-send-email-behanw@converseincode.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130906_173829_543797_87C60306 X-CRM114-Status: GOOD ( 11.57 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Will Drewry , Will Deacon , open list , Wade Farnsworth , "moderated list:ARM PORT" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org From: Behan Webster A macro to get the current stack pointer which allows for a single place in which to do so with ASM. Before this named registers (a gcc extension) was used to get the stack pointer. Using ASM is a more portable way of getting the stack pointer which works with both gcc and clang. This macro is of the same name used in the X86 arch. Author: Behan Webster Signed-off-by: Behan Webster Reviewed-by: Jan-Simon Möller --- arch/arm/include/asm/thread_info.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index df5e13d..94283f8 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h @@ -100,6 +100,15 @@ struct thread_info { #define init_stack (init_thread_union.stack) /* + * how to get the current stack pointer from C + */ +#define current_stack_pointer ({ \ + unsigned long current_sp; \ + asm ("mov %0, r13" : "=r" (current_sp)); \ + current_sp; \ +}) + +/* * how to get the thread information struct from C */ static inline struct thread_info *current_thread_info(void) __attribute_const__;