mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Peter Mamonov <pmamonov@gmail.com>
To: barebox@lists.infradead.org
Cc: Peter Mamonov <pmamonov@gmail.com>
Subject: [PATCH v3 08/12] MIPS: fix copy_to_link_location for 64 bit mode
Date: Tue, 22 May 2018 18:33:38 +0300	[thread overview]
Message-ID: <20180522153342.24933-9-pmamonov@gmail.com> (raw)
In-Reply-To: <20180522153342.24933-1-pmamonov@gmail.com>

MIPS `lw` instruction loads a 32 bit word from memory on both 32 bit and 64 bit
systems. On the other hand LONGSIZE is either 4 or 8 depending on selected code
model. This discrepancy causes copy_to_link_location failure on 64 bit systems.

Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
---
 arch/mips/include/asm/pbl_macros.h | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/arch/mips/include/asm/pbl_macros.h b/arch/mips/include/asm/pbl_macros.h
index 37b150ac2..18115c848 100644
--- a/arch/mips/include/asm/pbl_macros.h
+++ b/arch/mips/include/asm/pbl_macros.h
@@ -134,21 +134,22 @@
 	subu	t2, t1, t0	/* t2 <- size of pbl */
 	addu	a2, a0, t2	/* a2 <- source end address */
 
+#define WSIZE	4
 copy_loop:
 	/* copy from source address [a0] */
-	lw	t4, LONGSIZE * 0(a0)
-	lw	t5, LONGSIZE * 1(a0)
-	lw	t6, LONGSIZE * 2(a0)
-	lw	t7, LONGSIZE * 3(a0)
+	lw	t4, WSIZE * 0(a0)
+	lw	t5, WSIZE * 1(a0)
+	lw	t6, WSIZE * 2(a0)
+	lw	t7, WSIZE * 3(a0)
 	/* copy to target address [a1] */
-	sw	t4, LONGSIZE * 0(a1)
-	sw	t5, LONGSIZE * 1(a1)
-	sw	t6, LONGSIZE * 2(a1)
-	sw	t7, LONGSIZE * 3(a1)
-	addi	a0, LONGSIZE * 4
+	sw	t4, WSIZE * 0(a1)
+	sw	t5, WSIZE * 1(a1)
+	sw	t6, WSIZE * 2(a1)
+	sw	t7, WSIZE * 3(a1)
+	addi	a0, WSIZE * 4
 	subu	t3, a0, a2
 	blez	t3, copy_loop
-	 addi	a1, LONGSIZE * 4
+	 addi	a1, WSIZE * 4
 
 copy_loop_exit:
 
-- 
2.17.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-05-22 15:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-22 15:33 [PATCH v3 00/12] various fixes for MIPS64 Peter Mamonov
2018-05-22 15:33 ` [PATCH v3 01/12] resource: fix iomem_resource.end for 64 bit systems Peter Mamonov
2018-05-22 15:33 ` [PATCH v3 02/12] fs: fix memory access via /dev/mem for MIPS64 Peter Mamonov
2018-05-24 10:47   ` Sascha Hauer
2018-05-24 14:01     ` [PATCH v4] " Peter Mamonov
2018-06-13  8:31       ` Sascha Hauer
2018-06-13 16:17         ` [RESEND " Peter Mamonov
2018-06-14  5:36           ` Sascha Hauer
2018-05-22 15:33 ` [PATCH v3 03/12] mtd: cfi-flash: fix write_buff() for 64 bit systems Peter Mamonov
2018-05-22 15:33 ` [PATCH v3 04/12] i2c-mux-pca954x: fix out-of-bounds write " Peter Mamonov
2018-05-22 15:33 ` [PATCH v3 05/12] MIPS: import 64-bit address conversion macros Peter Mamonov
2018-05-22 15:33 ` [PATCH v3 06/12] include/common.h: move IOMEM declaration for MIPS to arch/mips/include/asm/io.h Peter Mamonov
2018-05-22 15:33 ` [PATCH v3 07/12] MIPS: add proper IOMEM() declaration for MIPS64 Peter Mamonov
2018-05-22 15:33 ` Peter Mamonov [this message]
2018-05-22 15:33 ` [PATCH v3 09/12] MIPS: use CKSEG1 instead of KSEG1 Peter Mamonov
2018-05-22 15:33 ` [PATCH v3 10/12] MIPS: add PHYS_ADDR_T_64BIT option Peter Mamonov
2018-05-22 15:33 ` [PATCH v3 11/12] MIPS: 64BIT selects PHYS_ADDR_T_64BIT Peter Mamonov
2018-05-22 15:33 ` [PATCH v3 12/12] MIPS: don't use optimized string functions for MIPS64 Peter Mamonov
2018-05-23  8:11 ` [PATCH v3 00/12] various fixes " 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=20180522153342.24933-9-pmamonov@gmail.com \
    --to=pmamonov@gmail.com \
    --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