From: ben.dooks@codethink.co.uk (Ben Dooks)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 03/10] ARM: fixup_pv_table bug when CPU_ENDIAN_BE8
Date: Mon, 1 Jul 2013 12:04:01 +0100 [thread overview]
Message-ID: <1372676648-9254-4-git-send-email-ben.dooks@codethink.co.uk> (raw)
In-Reply-To: <1372676648-9254-1-git-send-email-ben.dooks@codethink.co.uk>
The fixup_pv_table assumes that the instructions are in the same
endian configuration as the data, but when the CPU is running in
BE8 the instructions stay in little-endian format.
Make sure if CONFIG_CPU_ENDIAN_BE8 is set that we do all the
alterations to the instructions taking in to account the LDR/STR
will be swapping the data endian-ness.
Since the code is only modifying a byte, we avoid dual-swapping
the data, and just change the bits we clear and ORR in.
Note, not tested against an actual bug, it looked wrong.
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
arch/arm/kernel/head.S | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 8bac553..56ddd47 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -594,8 +594,14 @@ __fixup_a_pv_table:
#else
b 2f
1: ldr ip, [r7, r3]
+#ifdef CONFIG_CPU_ENDIAN_BE8
+ @ in BE8, we load data in BE, but instructions still in LE
+ bic ip, ip, #0xff000000
+ orr ip, ip, r6, lsl#24
+#else
bic ip, ip, #0x000000ff
orr ip, ip, r6 @ mask in offset bits 31-24
+#endif
str ip, [r7, r3]
2: cmp r4, r5
ldrcc r7, [r4], #4 @ use branch for delay slot
--
1.7.10.4
next prev parent reply other threads:[~2013-07-01 11:04 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-01 11:03 v3.10 - big endian core support Ben Dooks
2013-07-01 11:03 ` [PATCH 01/10] ARM: fix ARCH_IXP4xx usage of ARCH_SUPPORTS_BIG_ENDIAN Ben Dooks
2013-07-01 11:04 ` [PATCH 02/10] ARM: asm: Add ARM_BE8() assembly helper Ben Dooks
2013-07-01 11:04 ` Ben Dooks [this message]
2013-07-01 11:04 ` [PATCH 04/10] ARM: set BE8 if LE in head code Ben Dooks
2013-07-01 11:04 ` [PATCH 05/10] ARM: pl01x debug code endian fix Ben Dooks
2013-07-01 11:04 ` [PATCH 06/10] ARM: twd: data " Ben Dooks
2013-07-01 11:04 ` [PATCH 07/10] ARM: smp_scu: data endian fixes Ben Dooks
2013-07-01 11:04 ` [PATCH 08/10] highbank: enable big-endian Ben Dooks
2013-07-01 11:04 ` [PATCH 09/10] mvebu: support running big-endian Ben Dooks
2013-07-01 11:04 ` [PATCH 10/10] vexpress: add big endian support Ben Dooks
2013-07-01 14:33 ` v3.10 - big endian core support Thomas Petazzoni
2013-07-01 15:20 ` Ben Dooks
2013-07-08 5:39 ` jgq516 at gmail.com
2013-07-08 8:49 ` Will Deacon
2013-07-08 9:51 ` jgq516 at gmail.com
2013-07-08 11:02 ` Will Deacon
2013-07-08 17:03 ` Will Deacon
2013-07-09 1:18 ` jgq516 at gmail.com
2013-07-09 3:34 ` jgq516 at gmail.com
2013-07-09 7:45 ` Will Deacon
2013-07-09 9:55 ` jgq516 at gmail.com
2013-07-09 10:04 ` jgq516 at gmail.com
2013-07-09 15:36 ` Thomas Petazzoni
2013-07-08 9:58 ` Ben Dooks
2013-07-08 10:03 ` jgq516 at gmail.com
2013-07-08 11:10 ` Ben Dooks
2013-07-09 9:53 ` jgq516 at gmail.com
2013-07-09 9:59 ` Ben Dooks
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=1372676648-9254-4-git-send-email-ben.dooks@codethink.co.uk \
--to=ben.dooks@codethink.co.uk \
--cc=linux-arm-kernel@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;
as well as URLs for NNTP newsgroup(s).