From: ben.dooks@codethink.co.uk (Ben Dooks)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 02/10] ARM: fixup_pv_table bug when CPU_ENDIAN_BE8
Date: Wed, 19 Jun 2013 13:36:38 +0100 [thread overview]
Message-ID: <1371645406-16873-3-git-send-email-ben.dooks@codethink.co.uk> (raw)
In-Reply-To: <1371645406-16873-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-06-19 12:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-19 12:36 Initial big-endian support series Ben Dooks
2013-06-19 12:36 ` [PATCH 01/10] ARM: fix ARCH_IXP4xx usage of ARCH_SUPPORTS_BIG_ENDIAN Ben Dooks
2013-06-19 17:30 ` Thomas Petazzoni
2013-06-20 11:07 ` Ben Dooks
2013-06-19 12:36 ` Ben Dooks [this message]
2013-06-19 17:33 ` [PATCH 02/10] ARM: fixup_pv_table bug when CPU_ENDIAN_BE8 Thomas Petazzoni
2013-06-20 10:54 ` Ben Dooks
2013-06-20 16:09 ` Thomas Petazzoni
2013-06-19 12:36 ` [PATCH 03/10] ARM: asm: Add ARM_BE8() assembly helper Ben Dooks
2013-06-19 12:36 ` [PATCH 04/10] ARM: set BE8 if LE in head code Ben Dooks
2013-06-19 12:36 ` [PATCH 05/10] ARM: pl01x debug code endian fix Ben Dooks
2013-06-19 12:36 ` [PATCH 06/10] ARM: twd: data " Ben Dooks
2013-06-19 12:36 ` [PATCH 07/10] ARM: smp_scu: data endian fixes Ben Dooks
2013-06-19 12:36 ` [PATCH 08/10] highbank: enable big-endian Ben Dooks
2013-06-19 12:36 ` [PATCH 09/10] mvebu: support running big-endian Ben Dooks
2013-06-19 12:36 ` [PATCH 10/10] vexpress: add big endian support Ben Dooks
2013-06-20 16:12 ` Initial big-endian support series Thomas Petazzoni
2013-06-27 17:16 ` 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=1371645406-16873-3-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).