From patchwork Wed Mar 8 17:46:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Lagerwall X-Patchwork-Id: 9611741 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 953B8602B4 for ; Wed, 8 Mar 2017 17:49:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 834E928618 for ; Wed, 8 Mar 2017 17:49:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 781B928624; Wed, 8 Mar 2017 17:49:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2DCA628618 for ; Wed, 8 Mar 2017 17:49:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clfgL-0004ZI-1x; Wed, 08 Mar 2017 17:47:25 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clfgJ-0004Z4-Sn for xen-devel@lists.xen.org; Wed, 08 Mar 2017 17:47:23 +0000 Received: from [85.158.139.211] by server-2.bemta-5.messagelabs.com id FF/98-20080-BA340C85; Wed, 08 Mar 2017 17:47:23 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphkeJIrShJLcpLzFFi42JxWrrBXneV84E Ig7YXWhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bF/7+YCxYKVMy98Y21gfE1TxcjB4eEgL/E w/85XYycHGwCBhK3Ln1nBrFFBNQlTndcZO1i5OJgFrjAKHHw3TZ2kISwQIDEy6svWEBsFgEVi V93OxlBbF4BD4lrN2aCxSUE5CRunusEG8Qp4CmxsHE6M8guIaCalgfmIGEhATWJt8vPsEC0Ck qcnPkEzGYWkJA4+OIF8wRG3llIUrOQpBYwMq1i1ChOLSpLLdI1tNRLKspMzyjJTczM0TU0MNX LTS0uTkxPzUlMKtZLzs/dxAgMnXoGBsYdjI/6/Q4xSnIwKYnyui3bGyHEl5SfUpmRWJwRX1Sa k1p8iFGGg0NJgnfHVqCcYFFqempFWmYOMIhh0hIcPEoivF+2AKV5iwsSc4sz0yFSpxgVpcR5/ UD6BEASGaV5cG2wyLnEKCslzMvIwMAgxFOQWpSbWYIq/4pRnINRSZi3FGQKT2ZeCdz0V0CLmY AWa7uCLS5JREhJNTA6zD3PK1qr3fNEPlXRQ+nk8Q/mc5SeTJljN/dm8JtfL98/K+1NDpg1/c4 /7xnCm7QaNSd7JrBfLOE/vIClocxpkexE1f6fd63cS1at//dP5Hrei8snAv/vy8pjEROc2Nz+ YusDncmPRcLu7d+utDrPyScxOk+zadqtg/zdsxrv+/b2nt4k8a5biaU4I9FQi7moOBEAqq2x3 ZcCAAA= X-Env-Sender: prvs=233b396aa=ross.lagerwall@citrix.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1488995240!86865657!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57303 invoked from network); 8 Mar 2017 17:47:22 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-5.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 8 Mar 2017 17:47:22 -0000 X-IronPort-AV: E=Sophos;i="5.36,265,1486425600"; d="scan'208";a="421279759" From: Ross Lagerwall To: Xen-devel Date: Wed, 8 Mar 2017 17:46:50 +0000 Message-ID: <1488995215-7647-2-git-send-email-ross.lagerwall@citrix.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488995215-7647-1-git-send-email-ross.lagerwall@citrix.com> References: <1488995215-7647-1-git-send-email-ross.lagerwall@citrix.com> MIME-Version: 1.0 Cc: Ross Lagerwall , Dario Faggioli , Roger Pau Monne , Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH v2 1/6] lib: Add a generic implementation of current_text_addr() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Remove the unused x86 implementation. Signed-off-by: Ross Lagerwall Reviewed-by: Dario Faggioli --- Changes in v2: * Include Clang in the comment. xen/common/lib.c | 12 ++++++++++++ xen/include/asm-x86/processor.h | 10 ---------- xen/include/xen/lib.h | 2 ++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/xen/common/lib.c b/xen/common/lib.c index 6233020..7674d3a 100644 --- a/xen/common/lib.c +++ b/xen/common/lib.c @@ -501,6 +501,18 @@ void __init init_constructors(void) } /* + * The GCC and Clang docs state that the function must be marked noinline to + * have the expected result. From the GCC docs: + * "When inlining the expected behavior is that the function returns the + * address of the function that is returned to. To work around this behavior + * use the noinline function attribute." + */ +noinline void *current_text_addr(void) +{ + return __builtin_return_address(0); +} + +/* * Local variables: * mode: C * c-file-style: "BSD" diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h index dda8b83..f9de357 100644 --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -98,16 +98,6 @@ struct domain; struct vcpu; -/* - * Default implementation of macro that returns current - * instruction pointer ("program counter"). - */ -#define current_text_addr() ({ \ - void *pc; \ - asm ( "leaq 1f(%%rip),%0\n1:" : "=r" (pc) ); \ - pc; \ -}) - struct x86_cpu_id { uint16_t vendor; uint16_t family; diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h index 995a85a..6b4f1e4 100644 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -162,6 +162,8 @@ extern void add_taint(unsigned int taint); struct cpu_user_regs; void dump_execstate(struct cpu_user_regs *); +void *current_text_addr(void); + void init_constructors(void); void *bsearch(const void *key, const void *base, size_t num, size_t size,