public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: u-boot@lists.denx.de
Subject: [PATCH 4/5] Nokia RX-51: Simplify calculation of attached kernel image address
Date: Thu, 11 Aug 2022 22:27:24 +0200	[thread overview]
Message-ID: <20220811202725.24752-4-pali@kernel.org> (raw)
In-Reply-To: <20220811202725.24752-1-pali@kernel.org>

Now when board starup code does not copy image to CONFIG_SYS_TEXT_BASE
address there is no need to calculate all addresses from base address at
runtime. The only address which needs to be calculated is attached kernel
image address which can be simplified at compile time without need to know
CONFIG_SYS_TEXT_BASE address or relocation address at the runtime.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 board/nokia/rx51/lowlevel_init.S | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S
index 4f76e80b20f1..c1785bc3f72f 100644
--- a/board/nokia/rx51/lowlevel_init.S
+++ b/board/nokia/rx51/lowlevel_init.S
@@ -6,11 +6,8 @@
 
 #include <config.h>
 
-relocaddr:		/* address of this relocaddr section after coping */
-	.word .		/* address of section (calculated at compile time) */
-
-startaddr:		/* address of u-boot after copying */
-	.word CONFIG_SYS_TEXT_BASE
+kernoffs:		/* offset of kernel image from this address */
+	.word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)
 
 kernaddr:		/* address of kernel after copying */
 	.word KERNEL_ADDRESS
@@ -18,9 +15,6 @@ kernaddr:		/* address of kernel after copying */
 kernsize:		/* maximal size of kernel image */
 	.word KERNEL_MAXSIZE
 
-kernoffs:		/* offset of kernel image in loaded u-boot */
-	.word KERNEL_OFFSET
-
 imagesize:		/* maximal size of image */
 	.word IMAGE_MAXSIZE
 
@@ -53,16 +47,9 @@ save_boot_params:
  */
 
 copy_kernel_start:
-	adr	r0, relocaddr	/* r0 - address of section relocaddr */
-	ldr	r1, relocaddr	/* r1 - address of relocaddr after relocation */
-
-	/* r4 - calculated offset */
-	sub	r4, r0, r1
-
 	/* r0 - start of kernel before */
-	ldr	r0, startaddr
-	add	r0, r0, r4
-	ldr	r1, kernoffs
+	adr	r0, kernoffs	/* r0 - current address of kernoffs section */
+	ldr	r1, kernoffs	/* r1 - offset of kernel image from kernoffs section */
 	add	r0, r0, r1
 
 	/* r3 - start of kernel after */
-- 
2.20.1


  parent reply	other threads:[~2022-08-11 20:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11 20:27 [PATCH 1/5] Nokia RX-51: Fix invalidating zImage kernel format Pali Rohár
2022-08-11 20:27 ` [PATCH 2/5] Nokia RX-51: Use U-Boot generic position independent code Pali Rohár
2022-08-20 23:01   ` Tom Rini
2022-08-11 20:27 ` [PATCH 3/5] Nokia RX-51: Simplify copy kernel code Pali Rohár
2022-08-20 23:01   ` Tom Rini
2022-08-11 20:27 ` Pali Rohár [this message]
2022-08-20 23:01   ` [PATCH 4/5] Nokia RX-51: Simplify calculation of attached kernel image address Tom Rini
2022-08-11 20:27 ` [PATCH 5/5] Nokia RX-51: Move board required options from defconfig to Kconfig Pali Rohár
2022-08-20 23:01   ` Tom Rini
2022-08-20 23:01 ` [PATCH 1/5] Nokia RX-51: Fix invalidating zImage kernel format Tom Rini

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=20220811202725.24752-4-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=u-boot@lists.denx.de \
    /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