Skip to content

Commit 4e79f02

Browse files
committed
ARM: p2v: fix handling of LPAE translation in BE mode
When running in BE mode on LPAE hardware with a PA-to-VA translation that exceeds 4 GB, we patch bits 39:32 of the offset into the wrong byte of the opcode. So fix that, by rotating the offset in r0 to the right by 8 bits, which will put the 8-bit immediate in bits 31:24. Note that this will also move bit #22 in its correct place when applying the rotation to the constant #0x400000. Fixes: d9a790d ("ARM: 7883/1: fix mov to mvn conversion in case of 64 bit phys_addr_t and BE") Acked-by: Nicolas Pitre <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 3650b22 commit 4e79f02

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

arch/arm/kernel/head.S

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -671,12 +671,8 @@ ARM_BE8(rev16 ip, ip)
671671
ldrcc r7, [r4], #4 @ use branch for delay slot
672672
bcc 1b
673673
bx lr
674-
#else
675-
#ifdef CONFIG_CPU_ENDIAN_BE8
676-
moveq r0, #0x00004000 @ set bit 22, mov to mvn instruction
677674
#else
678675
moveq r0, #0x400000 @ set bit 22, mov to mvn instruction
679-
#endif
680676
b 2f
681677
1: ldr ip, [r7, r3]
682678
#ifdef CONFIG_CPU_ENDIAN_BE8
@@ -685,7 +681,7 @@ ARM_BE8(rev16 ip, ip)
685681
tst ip, #0x000f0000 @ check the rotation field
686682
orrne ip, ip, r6, lsl #24 @ mask in offset bits 31-24
687683
biceq ip, ip, #0x00004000 @ clear bit 22
688-
orreq ip, ip, r0 @ mask in offset bits 7-0
684+
orreq ip, ip, r0, ror #8 @ mask in offset bits 7-0
689685
#else
690686
bic ip, ip, #0x000000ff
691687
tst ip, #0xf00 @ check the rotation field

0 commit comments

Comments
 (0)