From: Ross Lagerwall <ross.lagerwall@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Ross Lagerwall <ross.lagerwall@citrix.com>,
Dario Faggioli <dario.faggioli@citrix.com>,
Roger Pau Monne <roger.pau@citrix.com>,
Jan Beulich <jbeulich@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH v2 1/6] lib: Add a generic implementation of current_text_addr()
Date: Wed, 8 Mar 2017 17:46:50 +0000 [thread overview]
Message-ID: <1488995215-7647-2-git-send-email-ross.lagerwall@citrix.com> (raw)
In-Reply-To: <1488995215-7647-1-git-send-email-ross.lagerwall@citrix.com>
Remove the unused x86 implementation.
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
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,
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-03-08 17:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-08 17:46 [PATCH v2 0/6] Remove dependency on __LINE__ Ross Lagerwall
2017-03-08 17:46 ` Ross Lagerwall [this message]
2017-03-09 8:52 ` [PATCH v2 1/6] lib: Add a generic implementation of current_text_addr() Dario Faggioli
2017-03-09 10:29 ` Jan Beulich
2017-03-08 17:46 ` [PATCH v2 2/6] sched: Remove dependency on __LINE__ for release builds Ross Lagerwall
2017-03-09 9:03 ` Dario Faggioli
2017-03-08 17:46 ` [PATCH v2 3/6] mm: Use statically defined locking order Ross Lagerwall
2017-03-20 13:52 ` George Dunlap
2017-03-08 17:46 ` [PATCH v2 4/6] iommu: Remove dependency on __LINE__ for release builds Ross Lagerwall
2017-03-09 10:42 ` Jan Beulich
2017-03-15 10:07 ` Tian, Kevin
[not found] ` <5940F13702000000000EA4B6@prv-mh.provo.novell.com>
2017-12-07 11:00 ` Jan Beulich
2017-03-08 17:46 ` [PATCH v2 5/6] x86_emulate: " Ross Lagerwall
2017-03-09 10:45 ` Jan Beulich
2017-03-08 17:46 ` [PATCH v2 6/6] xen/arm: " Ross Lagerwall
2017-03-09 10:34 ` [PATCH v2 0/6] Remove dependency on __LINE__ Jan Beulich
2017-03-10 8:29 ` Ross Lagerwall
2017-03-10 8:50 ` Jan Beulich
2017-03-17 8:57 ` Ross Lagerwall
2017-03-17 9:10 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1488995215-7647-2-git-send-email-ross.lagerwall@citrix.com \
--to=ross.lagerwall@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=dario.faggioli@citrix.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).