summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-09-10 07:47:39 +0200
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2020-09-14 23:28:52 +0200
commit6b9966e1aa362e97e9b33b7b82ff713f2ddea2c1 (patch)
tree14e78259abcd6048df08632b5aaba134beb80db4 /arch
parente5a31376acdd3f07a08be4433d9113ba61319204 (diff)
riscv: define function set_gd()
Function set_gd() is needed in the UEFI sub-system if the global data pointer is stored in a register. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/riscv/include/asm/global_data.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/riscv/include/asm/global_data.h b/arch/riscv/include/asm/global_data.h
index 2eb14815bc..b711fcc44d 100644
--- a/arch/riscv/include/asm/global_data.h
+++ b/arch/riscv/include/asm/global_data.h
@@ -39,4 +39,13 @@ struct arch_global_data {
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("gp")
+static inline void set_gd(volatile gd_t *gd_ptr)
+{
+#ifdef CONFIG_64BIT
+ asm volatile("ld gp, %0\n" : : "m"(gd_ptr));
+#else
+ asm volatile("lw gp, %0\n" : : "m"(gd_ptr));
+#endif
+}
+
#endif /* __ASM_GBL_DATA_H */