From: ben.dooks@codethink.co.uk (Ben Dooks)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/9] ARM: fixup_pv_table bug when CPU_ENDIAN_BE8
Date: Wed, 13 Feb 2013 10:55:20 +0000 [thread overview]
Message-ID: <1360752927-29331-3-git-send-email-ben.dooks@codethink.co.uk> (raw)
In-Reply-To: <1360752927-29331-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 486a15a..cc15384 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -576,8 +576,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-02-13 10:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-13 10:55 [RFC v3] Better BE support for ARM Ben Dooks
2013-02-13 10:55 ` [PATCH 1/9] ARM: fix ARCH_IXP4xx usage of ARCH_SUPPORTS_BIG_ENDIAN Ben Dooks
2013-02-18 19:58 ` Krzysztof Halasa
2013-02-13 10:55 ` Ben Dooks [this message]
2013-02-19 12:04 ` [PATCH 2/9] ARM: fixup_pv_table bug when CPU_ENDIAN_BE8 Dave Martin
2013-02-13 10:55 ` [PATCH 3/9] ARM: asm: Add ARM_BE8() assembly helper Ben Dooks
2013-02-14 4:27 ` Nicolas Pitre
2013-02-19 12:07 ` Dave Martin
2013-02-13 10:55 ` [PATCH 4/9] ARM: set BE8 if LE in head code Ben Dooks
2013-02-14 4:33 ` Nicolas Pitre
2013-02-13 10:55 ` [PATCH 5/9] ARM: pl01x debug code endian fix Ben Dooks
2013-02-19 12:27 ` Dave Martin
2013-02-13 10:55 ` [PATCH 6/9] ARM: twd: data " Ben Dooks
2013-02-13 10:55 ` [PATCH 7/9] ARM: smp_scu: data endian fixes Ben Dooks
2013-02-13 10:55 ` [PATCH 8/9] highbank: enable big-endian Ben Dooks
2013-02-13 10:55 ` [PATCH 9/9] mvebu: support running big-endian Ben Dooks
2013-02-15 11:39 ` [RFC v3] Better BE support for ARM Ben Dooks
2013-02-19 12:00 ` Dave Martin
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=1360752927-29331-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.