Commit 4b16421c authored by Ard Biesheuvel's avatar Ard Biesheuvel

ARM: p2v: factor out shared loop processing

The ARM and Thumb2 versions of the p2v patching loop have some overlap
at the end of the loop, so factor that out. As numeric labels are not
required to be unique, and may therefore be ambiguous, use named local
labels for the start and end of the loop instead.
Acked-by: default avatarNicolas Pitre <nico@fluxnic.net>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
parent eae78e1a
...@@ -68,7 +68,7 @@ __fixup_a_pv_table: ...@@ -68,7 +68,7 @@ __fixup_a_pv_table:
#ifdef CONFIG_THUMB2_KERNEL #ifdef CONFIG_THUMB2_KERNEL
moveq r0, #0x200000 @ set bit 21, mov to mvn instruction moveq r0, #0x200000 @ set bit 21, mov to mvn instruction
lsls r6, #24 lsls r6, #24
beq 2f beq .Lnext
clz r7, r6 clz r7, r6
lsr r6, #24 lsr r6, #24
lsl r6, r7 lsl r6, r7
...@@ -77,8 +77,8 @@ __fixup_a_pv_table: ...@@ -77,8 +77,8 @@ __fixup_a_pv_table:
orrcs r6, #0x0080 orrcs r6, #0x0080
orr r6, r6, r7, lsl #12 orr r6, r6, r7, lsl #12
orr r6, #0x4000 orr r6, #0x4000
b 2f b .Lnext
1: add r7, r3 .Lloop: add r7, r3
ldrh ip, [r7, #2] ldrh ip, [r7, #2]
ARM_BE8(rev16 ip, ip) ARM_BE8(rev16 ip, ip)
tst ip, #0x4000 tst ip, #0x4000
...@@ -87,21 +87,17 @@ ARM_BE8(rev16 ip, ip) ...@@ -87,21 +87,17 @@ ARM_BE8(rev16 ip, ip)
orreq ip, r0 @ mask in offset bits 7-0 orreq ip, r0 @ mask in offset bits 7-0
ARM_BE8(rev16 ip, ip) ARM_BE8(rev16 ip, ip)
strh ip, [r7, #2] strh ip, [r7, #2]
bne 2f bne .Lnext
ldrh ip, [r7] ldrh ip, [r7]
ARM_BE8(rev16 ip, ip) ARM_BE8(rev16 ip, ip)
bic ip, #0x20 bic ip, #0x20
orr ip, ip, r0, lsr #16 orr ip, ip, r0, lsr #16
ARM_BE8(rev16 ip, ip) ARM_BE8(rev16 ip, ip)
strh ip, [r7] strh ip, [r7]
2: cmp r4, r5
ldrcc r7, [r4], #4 @ use branch for delay slot
bcc 1b
bx lr
#else #else
moveq r0, #0x400000 @ set bit 22, mov to mvn instruction moveq r0, #0x400000 @ set bit 22, mov to mvn instruction
b 2f b .Lnext
1: ldr ip, [r7, r3] .Lloop: ldr ip, [r7, r3]
#ifdef CONFIG_CPU_ENDIAN_BE8 #ifdef CONFIG_CPU_ENDIAN_BE8
@ in BE8, we load data in BE, but instructions still in LE @ in BE8, we load data in BE, but instructions still in LE
bic ip, ip, #0xff000000 bic ip, ip, #0xff000000
...@@ -117,11 +113,13 @@ ARM_BE8(rev16 ip, ip) ...@@ -117,11 +113,13 @@ ARM_BE8(rev16 ip, ip)
orreq ip, ip, r0 @ mask in offset bits 7-0 orreq ip, ip, r0 @ mask in offset bits 7-0
#endif #endif
str ip, [r7, r3] str ip, [r7, r3]
2: cmp r4, r5 #endif
.Lnext:
cmp r4, r5
ldrcc r7, [r4], #4 @ use branch for delay slot ldrcc r7, [r4], #4 @ use branch for delay slot
bcc 1b bcc .Lloop
ret lr ret lr
#endif
ENDPROC(__fixup_a_pv_table) ENDPROC(__fixup_a_pv_table)
.align .align
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment