Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 14327c66 authored by Russell King's avatar Russell King
Browse files

ARM: replace BSYM() with badr assembly macro



BSYM() was invented to allow us to work around a problem with the
assembler, where local symbols resolved by the assembler for the 'adr'
instruction did not take account of their ISA.

Since we don't want BSYM() used elsewhere, replace BSYM() with a new
macro 'badr', which is like the 'adr' pseudo-op, but with the BSYM()
mechanics integrated into it.  This ensures that the BSYM()-ification
is only used in conjunction with 'adr'.

Acked-by: default avatarDave Martin <Dave.Martin@arm.com>
Acked-by: default avatarNicolas Pitre <nico@linaro.org>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 5890298a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ start:
		.endr
   ARM(		mov	r0, r0		)
   ARM(		b	1f		)
 THUMB(		adr	r12, BSYM(1f)	)
 THUMB(		badr	r12, 1f		)
 THUMB(		bx	r12		)

		.word	_magic_sig	@ Magic numbers to help the loader
@@ -447,7 +447,7 @@ dtb_check_done:

		bl	cache_clean_flush

		adr	r0, BSYM(restart)
		badr	r0, restart
		add	r0, r0, r6
		mov	pc, r0

+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@
ENTRY(mcpm_entry_point)

 ARM_BE8(setend        be)
 THUMB(	adr	r12, BSYM(1f)	)
 THUMB(	badr	r12, 1f		)
 THUMB(	bx	r12		)
 THUMB(	.thumb			)
1:
+16 −1
Original line number Diff line number Diff line
@@ -177,6 +177,21 @@
	restore_irqs_notrace \oldcpsr
	.endm

/*
 * Assembly version of "adr rd, BSYM(sym)".  This should only be used to
 * reference local symbols in the same assembly file which are to be
 * resolved by the assembler.  Other usage is undefined.
 */
	.irp	c,,eq,ne,cs,cc,mi,pl,vs,vc,hi,ls,ge,lt,gt,le,hs,lo
	.macro	badr\c, rd, sym
#ifdef CONFIG_THUMB2_KERNEL
	adr\c	\rd, \sym + 1
#else
	adr\c	\rd, \sym
#endif
	.endm
	.endr

/*
 * Get current thread_info.
 */
@@ -326,7 +341,7 @@
THUMB(	orr	\reg , \reg , #PSR_T_BIT	)
	bne	1f
	orr	\reg, \reg, #PSR_A_BIT
	adr	lr, BSYM(2f)
	badr	lr, 2f
	msr	spsr_cxsf, \reg
	__MSR_ELR_HYP(14)
	__ERET
+2 −2
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
	@
	@ routine called with r0 = irq number, r1 = struct pt_regs *
	@
	adrne	lr, BSYM(1b)
	badrne	lr, 1b
	bne	asm_do_IRQ

#ifdef CONFIG_SMP
@@ -23,7 +23,7 @@
	ALT_SMP(test_for_ipi r0, r2, r6, lr)
	ALT_UP_B(9997f)
	movne	r1, sp
	adrne	lr, BSYM(1b)
	badrne	lr, 1b
	bne	do_IPI
#endif
9997:
+0 −2
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@
#define THUMB(x...)	x
#ifdef __ASSEMBLY__
#define W(instr)	instr.w
#define BSYM(sym)	sym + 1
#else
#define WASM(instr)	#instr ".w"
#endif
@@ -59,7 +58,6 @@
#define THUMB(x...)
#ifdef __ASSEMBLY__
#define W(instr)	instr
#define BSYM(sym)	sym
#else
#define WASM(instr)	#instr
#endif
Loading