From: ben.dooks@codethink.co.uk (Ben Dooks)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 03/14] ARM: fixup_pv_table bug when CPU_ENDIAN_BE8
Date: Thu, 25 Jul 2013 11:34:38 +0100 [thread overview]
Message-ID: <51F0FF3E.3050206@codethink.co.uk> (raw)
In-Reply-To: <20130725102541.GC24642@n2100.arm.linux.org.uk>
On 25/07/13 11:25, Russell King - ARM Linux wrote:
> On Thu, Jul 25, 2013 at 11:14:42AM +0100, Will Deacon wrote:
>> What's wrong with the following?
>
> Is this like a challenge to find the silly mistake?
>
>> @@ -581,8 +581,13 @@ __fixup_a_pv_table:
>> b 2f
>> 1: add r7, r3
>> ldrh ip, [r7, #2]
>> +#ifdef CONFIG_CPU_ENDIAN_BE8
>> + and ip, 0x008f
>> + orr ip, ip, r6, lsl #24
>> +#else
>> and ip, 0x8f00
>> orr ip, r6 @ mask in offset bits 31-24
>> +#endif
>> strh ip, [r7, #2]
>
> Well, ip is being loaded/stored as 16bit, but you're putting r6 in to
> ip's bits 31-24, which are going to be ignored by the following strh.
>
> The comment "@ mask in offset bits 31-24" refers to the physical address
> bits here, which are already pre-shifted to bits 7-0 in r6.
I looked into this, and the code before this loop does:
clz r7, r6
lsr r6, #24
lsl r6, r7
bic r6, #0x0080
lsrs r7, #1
orrcs r6, #0x0080
orr r6, r6, r7, lsl #12
orr r6, #0x4000
b 2f
Note that r6 has bits that are not in the 0..7 range, which makes life
difficult when dealing with the loop. If we are going to change the
loop then we will have to pre rev16 r6 before going in to it.
IE:
lsls r6, #24
beq 2f
clz r7, r6
lsr r6, #24
lsl r6, r7
bic r6, #0x0080
lsrs r7, #1
orrcs r6, #0x0080
orr r6, r6, r7, lsl #12
orr r6, #0x4000
ARM_BE8(rev16 r6, r6)
b 2f
1: add r7, r3
ldrh ip, [r7, #2]
#ifdef CONFIG_CPU_ENDIAN_BE8
and ip, 0x008f
#else
and ip, 0x8f00
#endif
orr ip, r6 @ mask in offset bits 31-24
strh ip, [r7, #2]
2: cmp r4, r5
ldrcc r7, [r4], #4 @ use branch for delay slot
bcc 1b
bx lr
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
next prev parent reply other threads:[~2013-07-25 10:34 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-24 10:27 [repost] ARM big-endian support Ben Dooks
2013-07-24 10:27 ` [PATCH 01/14] ARM: fix ARCH_IXP4xx usage of ARCH_SUPPORTS_BIG_ENDIAN Ben Dooks
2013-07-24 10:27 ` [PATCH 02/14] ARM: asm: Add ARM_BE8() assembly helper Ben Dooks
2013-07-24 14:28 ` Will Deacon
2013-07-24 14:38 ` Ben Dooks
2013-07-24 14:48 ` Ben Dooks
2013-07-24 10:27 ` [PATCH 03/14] ARM: fixup_pv_table bug when CPU_ENDIAN_BE8 Ben Dooks
2013-07-24 14:33 ` Will Deacon
2013-07-24 15:24 ` Ben Dooks
2013-07-25 10:14 ` Will Deacon
2013-07-25 10:21 ` Ben Dooks
2013-07-25 10:30 ` Will Deacon
2013-07-25 10:25 ` Russell King - ARM Linux
2013-07-25 10:34 ` Ben Dooks [this message]
2013-07-25 10:40 ` Will Deacon
2013-07-24 10:27 ` [PATCH 04/14] ARM: set BE8 if LE in head code Ben Dooks
2013-07-24 14:41 ` Will Deacon
2013-07-24 15:55 ` Ben Dooks
2013-07-24 10:27 ` [PATCH 05/14] ARM: pl01x debug code endian fix Ben Dooks
2013-07-24 14:44 ` Will Deacon
2013-07-24 10:27 ` [PATCH 06/14] ARM: twd: data " Ben Dooks
2013-07-24 14:49 ` Will Deacon
2013-07-24 15:00 ` Ben Dooks
2013-07-24 15:06 ` Ben Dooks
2013-07-24 16:29 ` Will Deacon
2013-07-24 10:27 ` [PATCH 07/14] ARM: smp_scu: data endian fixes Ben Dooks
2013-07-24 15:05 ` Will Deacon
2013-07-24 10:27 ` [PATCH 08/14] highbank: enable big-endian Ben Dooks
2013-07-24 10:27 ` [PATCH 09/14] mvebu: support running big-endian Ben Dooks
2013-07-24 10:27 ` [PATCH 10/14] vexpress: add big endian support Ben Dooks
2013-07-24 10:27 ` [PATCH 11/14] ARM: alignment: correctly decode instructions in BE8 mode Ben Dooks
2013-07-24 15:28 ` Will Deacon
2013-07-25 9:44 ` Will Deacon
2013-07-24 10:28 ` [PATCH 12/14] ARM: traps: use <asm/opcodes.h> to get correct instruction order Ben Dooks
2013-07-24 16:20 ` Will Deacon
2013-07-24 10:28 ` [PATCH 13/14] ARM: module: correctly relocate instructions in BE8 Ben Dooks
2013-07-25 9:54 ` Will Deacon
2013-07-24 10:28 ` [PATCH 14/14] ARM: set --be8 when linking modules Ben Dooks
2013-07-24 16:25 ` Will Deacon
2013-07-24 23:41 ` Nicolas Pitre
2013-07-24 16:05 ` [repost] ARM big-endian support Ben Dooks
2013-07-29 13:26 ` Thomas Petazzoni
2013-07-31 20:05 ` Ben Dooks
2013-08-01 6:21 ` Thomas Petazzoni
2013-08-03 16:49 ` Ben Dooks
2013-08-05 8:01 ` Thomas Petazzoni
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=51F0FF3E.3050206@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).