[PATCH 16/78] ARM: aarch64: implement get_pc()

Sascha Hauer s.hauer at pengutronix.de
Fri Mar 16 05:52:52 PDT 2018


The arm32 version can't be used on aarch64, implement an aarch64
specific version.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/include/asm/common.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/common.h b/arch/arm/include/asm/common.h
index 07ae619cea..97bfdc43f5 100644
--- a/arch/arm/include/asm/common.h
+++ b/arch/arm/include/asm/common.h
@@ -4,13 +4,19 @@
 static inline unsigned long get_pc(void)
 {
 	unsigned long pc;
-
+#ifdef CONFIG_CPU_32
 	__asm__ __volatile__(
                 "mov    %0, pc\n"
                 : "=r" (pc)
                 :
                 : "memory");
-
+#else
+	__asm__ __volatile__(
+                "adr    %0, .\n"
+                : "=r" (pc)
+                :
+                : "memory");
+#endif
 	return pc;
 }
 
-- 
2.16.1




More information about the barebox mailing list