public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Kyle McMartin <kyle-pfcGkIkfWfAsA/PxXw9srA@public.gmane.org>
To: linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org
Subject: [PATCH 1/2] kallsyms: restructure print_fn_descriptor_symbol
Date: Fri, 18 Apr 2008 03:48:56 -0400	[thread overview]
Message-ID: <20080418074856.GC16276@phobos.i.cabal.ca> (raw)

Factor out the function descriptor access from the print_symbol
call.

Signed-off-by: Kyle McMartin <kyle-pfcGkIkfWfAsA/PxXw9srA@public.gmane.org>
---
 include/linux/kallsyms.h |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 82de2fb..6734a3f 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -83,17 +83,21 @@ __attribute__((format(printf,1,2)));
 static inline void __check_printsym_format(const char *fmt, ...)
 {
 }
+
 /* ia64 and ppc64 use function descriptors, which contain the real address */
 #if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
-#define print_fn_descriptor_symbol(fmt, addr)		\
-do {						\
-	unsigned long *__faddr = (unsigned long*) addr;		\
-	print_symbol(fmt, __faddr[0]);		\
-} while (0)
+#define get_func_addr(x)	({				\
+					unsigned long *addr =	\
+						(unsigned long *)x;	\
+					addr[0];		\
+				})
 #else
-#define print_fn_descriptor_symbol(fmt, addr) print_symbol(fmt, addr)
+#define get_func_addr(x)	x
 #endif
 
+#define print_fn_descriptor_symbol(fmt, addr)	\
+		print_symbol(fmt, get_func_addr(addr))
+
 static inline void print_symbol(const char *fmt, unsigned long addr)
 {
 	__check_printsym_format(fmt, "");
-- 
1.5.4.5

WARNING: multiple messages have this Message-ID (diff)
From: Kyle McMartin <kyle@mcmartin.ca>
To: linux-arch@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, rusty@rustcorp.com.au,
	akpm@linux-foundation.org
Subject: [PATCH 1/2] kallsyms: restructure print_fn_descriptor_symbol
Date: Fri, 18 Apr 2008 03:48:56 -0400	[thread overview]
Message-ID: <20080418074856.GC16276@phobos.i.cabal.ca> (raw)
Message-ID: <20080418074856.ohroaj_vUkywY_G7kOm7gXoZWppRsVlipAlzObV2E-o@z> (raw)

Factor out the function descriptor access from the print_symbol
call.

Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
---
 include/linux/kallsyms.h |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 82de2fb..6734a3f 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -83,17 +83,21 @@ __attribute__((format(printf,1,2)));
 static inline void __check_printsym_format(const char *fmt, ...)
 {
 }
+
 /* ia64 and ppc64 use function descriptors, which contain the real address */
 #if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
-#define print_fn_descriptor_symbol(fmt, addr)		\
-do {						\
-	unsigned long *__faddr = (unsigned long*) addr;		\
-	print_symbol(fmt, __faddr[0]);		\
-} while (0)
+#define get_func_addr(x)	({				\
+					unsigned long *addr =	\
+						(unsigned long *)x;	\
+					addr[0];		\
+				})
 #else
-#define print_fn_descriptor_symbol(fmt, addr) print_symbol(fmt, addr)
+#define get_func_addr(x)	x
 #endif
 
+#define print_fn_descriptor_symbol(fmt, addr)	\
+		print_symbol(fmt, get_func_addr(addr))
+
 static inline void print_symbol(const char *fmt, unsigned long addr)
 {
 	__check_printsym_format(fmt, "");
-- 
1.5.4.5


             reply	other threads:[~2008-04-18  7:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-18  7:48 Kyle McMartin [this message]
2008-04-18  7:48 ` [PATCH 1/2] kallsyms: restructure print_fn_descriptor_symbol Kyle McMartin

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=20080418074856.GC16276@phobos.i.cabal.ca \
    --to=kyle-pfcgkikfwfasa/pxxw9sra@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.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