summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-05-27 01:58:30 +0200
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2020-06-03 17:19:17 +0200
commit4f7dc5f608c07f5bc169217bedac6883b0d998df (patch)
tree462d9e5d76b654737c733eef78b23c1e141ea9ad /arch
parent0e69bcfb27644f9e7c575aa3565bcff922c7dec2 (diff)
efi_loader: allow compiling with clang
On ARM systems gd is stored in register r9 or x18. When compiling with clang gd is defined as a macro calling function gd_ptr(). So we can not make assignments to gd. In the UEFI sub-system we need to save gd when leaving to UEFI binaries and have to restore gd when reentering U-Boot. Define a new function set_gd() for setting gd and use it in the UEFI sub-system. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Tested-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/global_data.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index f23b6bfb75..7c0905d240 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -117,4 +117,13 @@ static inline gd_t *get_gd(void)
#endif
#endif
+static inline void set_gd(volatile gd_t *gd_ptr)
+{
+#ifdef CONFIG_ARM64
+ __asm__ volatile("ldr x18, %0\n" : : "m"(gd_ptr));
+#else
+ __asm__ volatile("ldr r9, %0\n" : : "m"(gd_ptr));
+#endif
+}
+
#endif /* __ASM_GBL_DATA_H */