summaryrefslogtreecommitdiffstats
path: root/arch/arm/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-03-13 08:32:54 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-03-21 12:23:03 +0100
commit86c0e7e59d99070844bb8d1aa969ec1c2617bc6d (patch)
treefc2c3f6b916ac17691166348839a07a9fb4c3c02 /arch/arm/include
parent2da4c18e4c151cf0dfd6de1fde057974054b1d71 (diff)
downloadbarebox-86c0e7e59d99070844bb8d1aa969ec1c2617bc6d.tar.gz
barebox-86c0e7e59d99070844bb8d1aa969ec1c2617bc6d.tar.xz
ARM: Add function to return offset to global variables
ARM and aarch64 differ in the way global variables are addressed. This adds a function which abstracts the differences. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/include')
-rw-r--r--arch/arm/include/asm/barebox-arm.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 1dccb8965e..9fc8afbe7d 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -44,6 +44,20 @@ extern char __exceptions_start[], __exceptions_stop[];
void board_init_lowlevel(void);
unsigned long get_runtime_offset(void);
+/* global_variable_offset() - Access global variables when not running at link address
+ *
+ * Get the offset of global variables when not running at the address we are
+ * linked at. ARM uses absolute addresses, so we must add the runtime offset
+ * whereas aarch64 uses PC relative addresses, so nothing must be done here.
+ */
+static inline unsigned long global_variable_offset(void)
+{
+ if (IS_ENABLED(CONFIG_CPU_32))
+ return get_runtime_offset();
+ else
+ return 0;
+}
+
void setup_c(void);
void relocate_to_current_adr(void);
void relocate_to_adr(unsigned long target);