Commit 08446b12 authored by Russell King's avatar Russell King
Browse files

ARM: mm: improve do_ldrd_abort macro



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: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 1fb6755f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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
+2 −1
Original line number Diff line number Diff line
@@ -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
+2 −1
Original line number Diff line number Diff line
@@ -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
+5 −8
Original line number Diff line number Diff line
@@ -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