Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: head.S: use PC-relative insn sequence for secondary_data

Replace the open coded PC relative offset calculations with adr_l
and ldr_l invocations. This removes some open coded arithmetic
involving virtual addresses, avoids literal pools on v7+, and slightly
reduces the footprint of the code.

Note that it also removes a stale comment about the contents of r6.

Reviewed-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

+4 -15
+4 -15
arch/arm/kernel/head.S
··· 383 383 /* 384 384 * Use the page tables supplied from __cpu_up. 385 385 */ 386 - adr r4, __secondary_data 387 - ldmia r4, {r5, r7, r12} @ address to jump to after 388 - sub lr, r4, r5 @ mmu has been enabled 389 - add r3, r7, lr 386 + adr_l r3, secondary_data 387 + mov_l r12, __secondary_switched 390 388 ldrd r4, r5, [r3, #0] @ get secondary_data.pgdir 391 389 ARM_BE8(eor r4, r4, r5) @ Swap r5 and r4 in BE: 392 390 ARM_BE8(eor r5, r4, r5) @ it can be done in 3 steps ··· 399 401 ENDPROC(secondary_startup) 400 402 ENDPROC(secondary_startup_arm) 401 403 402 - /* 403 - * r6 = &secondary_data 404 - */ 405 404 ENTRY(__secondary_switched) 406 - ldr sp, [r7, #12] @ get secondary_data.stack 405 + ldr_l r7, secondary_data + 12 @ get secondary_data.stack 406 + mov sp, r7 407 407 mov fp, #0 408 408 b secondary_start_kernel 409 409 ENDPROC(__secondary_switched) 410 410 411 - .align 412 - 413 - .type __secondary_data, %object 414 - __secondary_data: 415 - .long . 416 - .long secondary_data 417 - .long __secondary_switched 418 411 #endif /* defined(CONFIG_SMP) */ 419 412 420 413