From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/3] ARM: asm: factor relocation related functions in asm/reloc.h
Date: Fri, 5 Aug 2022 09:42:36 +0200 [thread overview]
Message-ID: <20220805074237.1148255-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20220805074237.1148255-1-a.fatoum@pengutronix.de>
Like done for RISC-V, move declaration of the relocation functions
into asm/reloc.h
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/include/asm/barebox-arm.h | 29 +--------------------
arch/arm/include/asm/reloc.h | 42 ++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 28 deletions(-)
create mode 100644 arch/arm/include/asm/reloc.h
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 8795c89d515b..d901cb10013d 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -20,6 +20,7 @@
#include <asm/barebox-arm-head.h>
#include <asm/common.h>
#include <asm/sections.h>
+#include <asm/reloc.h>
/*
* We have a 4GiB address space split into 1MiB sections, with each
@@ -27,34 +28,6 @@
*/
#define ARM_TTB_SIZE (SZ_4G / SZ_1M * sizeof(u32))
-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.
- */
-static inline unsigned long global_variable_offset(void)
-{
-#ifdef CONFIG_CPU_V8
- unsigned long text;
-
- __asm__ __volatile__(
- "adr %0, _text\n"
- : "=r" (text)
- :
- : "memory");
- return text - (unsigned long)_text;
-#else
- return get_runtime_offset();
-#endif
-}
-
-void setup_c(void);
-void pbl_barebox_break(void);
-void relocate_to_current_adr(void);
-void relocate_to_adr(unsigned long target);
-void relocate_to_adr_full(unsigned long target);
void __noreturn barebox_arm_entry(unsigned long membase, unsigned long memsize, void *boarddata);
struct barebox_arm_boarddata {
diff --git a/arch/arm/include/asm/reloc.h b/arch/arm/include/asm/reloc.h
new file mode 100644
index 000000000000..0002c96c014c
--- /dev/null
+++ b/arch/arm/include/asm/reloc.h
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef _ASM_RELOC_H_
+#define _ASM_RELOC_H_
+
+#include <asm/sections.h>
+
+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.
+ */
+static inline unsigned long global_variable_offset(void)
+{
+#ifdef CONFIG_CPU_V8
+ unsigned long text;
+
+ __asm__ __volatile__(
+ "adr %0, _text\n"
+ : "=r" (text)
+ :
+ : "memory");
+ return text - (unsigned long)_text;
+#else
+ return get_runtime_offset();
+#endif
+}
+#define global_variable_offset() global_variable_offset()
+
+void relocate_to_current_adr(void);
+void relocate_to_adr(unsigned long target);
+void relocate_to_adr_full(unsigned long target);
+
+void pbl_barebox_break(void);
+
+void setup_c(void);
+
+#include <asm-generic/reloc.h>
+
+#endif
--
2.30.2
next prev parent reply other threads:[~2022-08-05 7:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-05 7:42 [PATCH 1/3] RISC-V: asm: factor relocation related functions into asm/reloc.h Ahmad Fatoum
2022-08-05 7:42 ` Ahmad Fatoum [this message]
2022-08-05 7:42 ` [PATCH 3/3] MIPS: asm: add get_runtime_offset stub Ahmad Fatoum
2022-08-08 12:48 ` [PATCH 1/3] RISC-V: asm: factor relocation related functions into asm/reloc.h Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220805074237.1148255-2-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox