Skip to content

Commit 03e8e5d

Browse files
ardbiesheuvelpelwell
authored andcommitted
ARM: p2v: simplify __fixup_pv_table()
commit 0e3db6c upstream. Declutter the code in __fixup_pv_table() by using the new adr_l/str_l macros to take PC relative references to external symbols, and by using the value of PHYS_OFFSET passed in r8 to calculate the p2v offset. Acked-by: Nicolas Pitre <nico@fluxnic.net> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent 40200bc commit 03e8e5d

1 file changed

Lines changed: 14 additions & 20 deletions

File tree

‎arch/arm/kernel/phys2virt.S‎

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,27 @@
2929
*/
3030
__HEAD
3131
ENTRY(__fixup_pv_table)
32-
adr r0, 1f
33-
ldmia r0, {r3-r7}
34-
mvn ip, #0
35-
subs r3, r0, r3 @ PHYS_OFFSET - PAGE_OFFSET
36-
add r4, r4, r3 @ adjust table start address
37-
add r5, r5, r3 @ adjust table end address
38-
add r6, r6, r3 @ adjust __pv_phys_pfn_offset address
39-
add r7, r7, r3 @ adjust __pv_offset address
4032
mov r0, r8, lsr #PAGE_SHIFT @ convert to PFN
41-
str r0, [r6] @ save computed PHYS_OFFSET to __pv_phys_pfn_offset
42-
strcc ip, [r7, #HIGH_OFFSET] @ save to __pv_offset high bits
43-
mov r6, r3, lsr #24 @ constant for add/sub instructions
44-
teq r3, r6, lsl #24 @ must be 16MiB aligned
33+
str_l r0, __pv_phys_pfn_offset, r3
34+
35+
adr_l r0, __pv_offset
36+
subs r3, r8, #PAGE_OFFSET @ PHYS_OFFSET - PAGE_OFFSET
37+
mvn ip, #0
38+
strcc ip, [r0, #HIGH_OFFSET] @ save to __pv_offset high bits
39+
str r3, [r0, #LOW_OFFSET] @ save to __pv_offset low bits
40+
41+
mov r0, r3, lsr #24 @ constant for add/sub instructions
42+
teq r3, r0, lsl #24 @ must be 16MiB aligned
4543
bne 0f
46-
str r3, [r7, #LOW_OFFSET] @ save to __pv_offset low bits
44+
45+
adr_l r4, __pv_table_begin
46+
adr_l r5, __pv_table_end
4747
b __fixup_a_pv_table
48+
4849
0: mov r0, r0 @ deadloop on error
4950
b 0b
5051
ENDPROC(__fixup_pv_table)
5152

52-
.align
53-
1: .long .
54-
.long __pv_table_begin
55-
.long __pv_table_end
56-
2: .long __pv_phys_pfn_offset
57-
.long __pv_offset
58-
5953
.text
6054
__fixup_a_pv_table:
6155
adr_l r6, __pv_offset

0 commit comments

Comments
 (0)