[PATCH 02/14] ppc: add a get_pc() function
Sascha Hauer
s.hauer at pengutronix.de
Tue Sep 27 04:28:17 EDT 2011
Useful to determine whether sdram has to be setup or not.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
arch/ppc/include/asm/common.h | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/arch/ppc/include/asm/common.h b/arch/ppc/include/asm/common.h
index 96de5c6..26876c7 100644
--- a/arch/ppc/include/asm/common.h
+++ b/arch/ppc/include/asm/common.h
@@ -21,4 +21,21 @@ void trap_init (ulong);
int cpu_init_board_data(bd_t *bd);
int init_board_data(bd_t *bd);
+static inline unsigned long get_pc(void)
+{
+ unsigned long pc;
+
+ __asm__ __volatile__(
+ " mflr 0\n"
+ " bl 1f\n"
+ "1:\n"
+ " mflr %0\n"
+ " mtlr 0\n"
+ : "=r" (pc)
+ :
+ : "0", "memory");
+
+ return pc;
+}
+
#endif /* __ASM_COMMON_H */
--
1.7.6.3
More information about the barebox
mailing list