mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 2/2] ARM: cpu: setupc: implement 32-bit relocate_to_adr_full
Date: Mon, 12 Jan 2026 09:56:40 +0100	[thread overview]
Message-ID: <20260112085709.2953004-2-a.fatoum@barebox.org> (raw)
In-Reply-To: <20260112085709.2953004-1-a.fatoum@barebox.org>

To move barebox out of QEMU's NOR flash and into RAM, implement
relocate_to_adr_full(), like we already do for ARM64.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
The series adding support for ARM Qemu Virt -bios will make use of this,
but this is already useful for other boards, so sending it out now.
---
 arch/arm/cpu/setupc_32.S | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/setupc_32.S b/arch/arm/cpu/setupc_32.S
index d3449d9646b9..0134637f6296 100644
--- a/arch/arm/cpu/setupc_32.S
+++ b/arch/arm/cpu/setupc_32.S
@@ -43,12 +43,21 @@ ENDPROC(setup_c)
  * executing at new address.
  */
 .section .text.relocate_to_adr
+#ifdef __PBL__
+ENTRY(relocate_to_adr_full)
+	ldr	r2, =__image_end
+	b	1f
+#endif
+
 ENTRY(relocate_to_adr)
-					/* r0: target address */
+	ldr	r2, =__bss_start
+	b	1f
+
+1:
 	push	{r3, r4, r5, r6, r7, r8}
 	mov	r7, lr
 
-	mov	r6, r0
+	mov	r6, r0			/* r0: target address */
 
 	bl	get_runtime_offset
 
@@ -61,8 +70,6 @@ ENTRY(relocate_to_adr)
 	cmp	r1, r6			/* already at correct address? */
 	beq	1f			/* yes, skip copy to new address */
 
-	ldr	r2, =__bss_start
-
 	sub	r2, r2, r8		/* r2: size */
 	mov	r0, r6			/* r0: target */
 
-- 
2.47.3




      reply	other threads:[~2026-01-12  8:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12  8:56 [PATCH 1/2] debug_ll: pl011: add PBL console helper Ahmad Fatoum
2026-01-12  8:56 ` Ahmad Fatoum [this message]

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=20260112085709.2953004-2-a.fatoum@barebox.org \
    --to=a.fatoum@barebox.org \
    --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