Skip to content

Commit

Permalink
ARM: mm: improve do_ldrd_abort macro
Browse files Browse the repository at this point in the history
Improve the do_ldrd_abort macro code - firstly, it inefficiently checks
for the LDRD encoding by doing a multi-stage test of various bits.  This
can be simplified by generating a mask, bitmasking the instruction and
then comparing the result.

Secondly, we want to be able to test the result rather than branching
to do_DataAbort, so remove the branch at the end and rename the macro
to 'teq_ldrd' to reflect it's new usage.  teq_ldrd macro returns 'eq'
if the instruction was a LDRD.

Signed-off-by: Russell King <[email protected]>
  • Loading branch information
Russell King committed Aug 25, 2015
1 parent 1fb6755 commit 08446b1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
3 changes: 2 additions & 1 deletion arch/arm/mm/abort-ev5t.S
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ ENTRY(v5t_early_abort)
do_thumb_abort fsr=r1, pc=r4, psr=r5, tmp=r3
ldreq r3, [r4] @ read aborted ARM instruction
bic r1, r1, #1 << 11 @ clear bits 11 of FSR
do_ldrd_abort tmp=ip, insn=r3
teq_ldrd tmp=ip, insn=r3 @ insn was LDRD?
beq do_DataAbort @ yes
tst r3, #1 << 20 @ check write
orreq r1, r1, #1 << 11
b do_DataAbort
3 changes: 2 additions & 1 deletion arch/arm/mm/abort-ev5tj.S
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ ENTRY(v5tj_early_abort)
bne do_DataAbort
do_thumb_abort fsr=r1, pc=r4, psr=r5, tmp=r3
ldreq r3, [r4] @ read aborted ARM instruction
do_ldrd_abort tmp=ip, insn=r3
teq_ldrd tmp=ip, insn=r3 @ insn was LDRD?
beq do_DataAbort @ yes
tst r3, #1 << 20 @ L = 0 -> write
orreq r1, r1, #1 << 11 @ yes.
b do_DataAbort
3 changes: 2 additions & 1 deletion arch/arm/mm/abort-ev6.S
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ ENTRY(v6_early_abort)
ldr r3, [r4] @ read aborted ARM instruction
ARM_BE8(rev r3, r3)

do_ldrd_abort tmp=ip, insn=r3
teq_ldrd tmp=ip, insn=r3 @ insn was LDRD?
beq do_DataAbort @ yes
tst r3, #1 << 20 @ L = 0 -> write
orreq r1, r1, #1 << 11 @ yes.
#endif
Expand Down
13 changes: 5 additions & 8 deletions arch/arm/mm/abort-macro.S
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ not_thumb:
* [7:4] == 1101
* [20] == 0
*/
.macro do_ldrd_abort, tmp, insn
tst \insn, #0x0e100000 @ [27:25,20] == 0
bne not_ldrd
and \tmp, \insn, #0x000000f0 @ [7:4] == 1101
cmp \tmp, #0x000000d0
beq do_DataAbort
not_ldrd:
.macro teq_ldrd, tmp, insn
mov \tmp, #0x0e100000
orr \tmp, #0x000000f0
and \tmp, \insn, \tmp
teq \tmp, #0x000000d0
.endm

0 comments on commit 08446b1

Please sign in to comment.