Commit 05c9ca88 authored by Russell King's avatar Russell King

Merge branch 'bsym' into for-next

Conflicts:
	arch/arm/kernel/head.S
parents c62af70f 14327c66
...@@ -130,7 +130,7 @@ start: ...@@ -130,7 +130,7 @@ start:
.endr .endr
ARM( mov r0, r0 ) ARM( mov r0, r0 )
ARM( b 1f ) ARM( b 1f )
THUMB( adr r12, BSYM(1f) ) THUMB( badr r12, 1f )
THUMB( bx r12 ) THUMB( bx r12 )
.word _magic_sig @ Magic numbers to help the loader .word _magic_sig @ Magic numbers to help the loader
...@@ -447,7 +447,7 @@ dtb_check_done: ...@@ -447,7 +447,7 @@ dtb_check_done:
bl cache_clean_flush bl cache_clean_flush
adr r0, BSYM(restart) badr r0, restart
add r0, r0, r6 add r0, r0, r6
mov pc, r0 mov pc, r0
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
ENTRY(mcpm_entry_point) ENTRY(mcpm_entry_point)
ARM_BE8(setend be) ARM_BE8(setend be)
THUMB( adr r12, BSYM(1f) ) THUMB( badr r12, 1f )
THUMB( bx r12 ) THUMB( bx r12 )
THUMB( .thumb ) THUMB( .thumb )
1: 1:
......
...@@ -177,6 +177,21 @@ ...@@ -177,6 +177,21 @@
restore_irqs_notrace \oldcpsr restore_irqs_notrace \oldcpsr
.endm .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. * Get current thread_info.
*/ */
...@@ -326,7 +341,7 @@ ...@@ -326,7 +341,7 @@
THUMB( orr \reg , \reg , #PSR_T_BIT ) THUMB( orr \reg , \reg , #PSR_T_BIT )
bne 1f bne 1f
orr \reg, \reg, #PSR_A_BIT orr \reg, \reg, #PSR_A_BIT
adr lr, BSYM(2f) badr lr, 2f
msr spsr_cxsf, \reg msr spsr_cxsf, \reg
__MSR_ELR_HYP(14) __MSR_ELR_HYP(14)
__ERET __ERET
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
@ @
@ routine called with r0 = irq number, r1 = struct pt_regs * @ routine called with r0 = irq number, r1 = struct pt_regs *
@ @
adrne lr, BSYM(1b) badrne lr, 1b
bne asm_do_IRQ bne asm_do_IRQ
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
ALT_SMP(test_for_ipi r0, r2, r6, lr) ALT_SMP(test_for_ipi r0, r2, r6, lr)
ALT_UP_B(9997f) ALT_UP_B(9997f)
movne r1, sp movne r1, sp
adrne lr, BSYM(1b) badrne lr, 1b
bne do_IPI bne do_IPI
#endif #endif
9997: 9997:
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#define THUMB(x...) x #define THUMB(x...) x
#ifdef __ASSEMBLY__ #ifdef __ASSEMBLY__
#define W(instr) instr.w #define W(instr) instr.w
#define BSYM(sym) sym + 1
#else #else
#define WASM(instr) #instr ".w" #define WASM(instr) #instr ".w"
#endif #endif
...@@ -59,7 +58,6 @@ ...@@ -59,7 +58,6 @@
#define THUMB(x...) #define THUMB(x...)
#ifdef __ASSEMBLY__ #ifdef __ASSEMBLY__
#define W(instr) instr #define W(instr) instr
#define BSYM(sym) sym
#else #else
#define WASM(instr) #instr #define WASM(instr) #instr
#endif #endif
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#ifdef CONFIG_MULTI_IRQ_HANDLER #ifdef CONFIG_MULTI_IRQ_HANDLER
ldr r1, =handle_arch_irq ldr r1, =handle_arch_irq
mov r0, sp mov r0, sp
adr lr, BSYM(9997f) badr lr, 9997f
ldr pc, [r1] ldr pc, [r1]
#else #else
arch_irq_handler_default arch_irq_handler_default
...@@ -273,7 +273,7 @@ __und_svc: ...@@ -273,7 +273,7 @@ __und_svc:
str r4, [sp, #S_PC] str r4, [sp, #S_PC]
orr r0, r9, r0, lsl #16 orr r0, r9, r0, lsl #16
#endif #endif
adr r9, BSYM(__und_svc_finish) badr r9, __und_svc_finish
mov r2, r4 mov r2, r4
bl call_fpe bl call_fpe
...@@ -469,7 +469,7 @@ __und_usr: ...@@ -469,7 +469,7 @@ __und_usr:
@ instruction, or the more conventional lr if we are to treat @ instruction, or the more conventional lr if we are to treat
@ this as a real undefined instruction @ this as a real undefined instruction
@ @
adr r9, BSYM(ret_from_exception) badr r9, ret_from_exception
@ IRQs must be enabled before attempting to read the instruction from @ IRQs must be enabled before attempting to read the instruction from
@ user space since that could cause a page/translation fault if the @ user space since that could cause a page/translation fault if the
...@@ -486,7 +486,7 @@ __und_usr: ...@@ -486,7 +486,7 @@ __und_usr:
@ r2 = PC value for the following instruction (:= regs->ARM_pc) @ r2 = PC value for the following instruction (:= regs->ARM_pc)
@ r4 = PC value for the faulting instruction @ r4 = PC value for the faulting instruction
@ lr = 32-bit undefined instruction function @ lr = 32-bit undefined instruction function
adr lr, BSYM(__und_usr_fault_32) badr lr, __und_usr_fault_32
b call_fpe b call_fpe
__und_usr_thumb: __und_usr_thumb:
...@@ -522,7 +522,7 @@ ARM_BE8(rev16 r0, r0) @ little endian instruction ...@@ -522,7 +522,7 @@ ARM_BE8(rev16 r0, r0) @ little endian instruction
add r2, r2, #2 @ r2 is PC + 2, make it PC + 4 add r2, r2, #2 @ r2 is PC + 2, make it PC + 4
str r2, [sp, #S_PC] @ it's a 2x16bit instr, update str r2, [sp, #S_PC] @ it's a 2x16bit instr, update
orr r0, r0, r5, lsl #16 orr r0, r0, r5, lsl #16
adr lr, BSYM(__und_usr_fault_32) badr lr, __und_usr_fault_32
@ r0 = the two 16-bit Thumb instructions which caused the exception @ r0 = the two 16-bit Thumb instructions which caused the exception
@ r2 = PC value for the following Thumb instruction (:= regs->ARM_pc) @ r2 = PC value for the following Thumb instruction (:= regs->ARM_pc)
@ r4 = PC value for the first 16-bit Thumb instruction @ r4 = PC value for the first 16-bit Thumb instruction
...@@ -716,7 +716,7 @@ __und_usr_fault_32: ...@@ -716,7 +716,7 @@ __und_usr_fault_32:
__und_usr_fault_16: __und_usr_fault_16:
mov r1, #2 mov r1, #2
1: mov r0, sp 1: mov r0, sp
adr lr, BSYM(ret_from_exception) badr lr, ret_from_exception
b __und_fault b __und_fault
ENDPROC(__und_usr_fault_32) ENDPROC(__und_usr_fault_32)
ENDPROC(__und_usr_fault_16) ENDPROC(__und_usr_fault_16)
......
...@@ -90,7 +90,7 @@ ENTRY(ret_from_fork) ...@@ -90,7 +90,7 @@ ENTRY(ret_from_fork)
bl schedule_tail bl schedule_tail
cmp r5, #0 cmp r5, #0
movne r0, r4 movne r0, r4
adrne lr, BSYM(1f) badrne lr, 1f
retne r5 retne r5
1: get_thread_info tsk 1: get_thread_info tsk
b ret_slow_syscall b ret_slow_syscall
...@@ -198,7 +198,7 @@ local_restart: ...@@ -198,7 +198,7 @@ local_restart:
bne __sys_trace bne __sys_trace
cmp scno, #NR_syscalls @ check upper syscall limit cmp scno, #NR_syscalls @ check upper syscall limit
adr lr, BSYM(ret_fast_syscall) @ return address badr lr, ret_fast_syscall @ return address
ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine
add r1, sp, #S_OFF add r1, sp, #S_OFF
...@@ -233,7 +233,7 @@ __sys_trace: ...@@ -233,7 +233,7 @@ __sys_trace:
add r0, sp, #S_OFF add r0, sp, #S_OFF
bl syscall_trace_enter bl syscall_trace_enter
adr lr, BSYM(__sys_trace_return) @ return address badr lr, __sys_trace_return @ return address
mov scno, r0 @ syscall number (possibly new) mov scno, r0 @ syscall number (possibly new)
add r1, sp, #S_R0 + S_OFF @ pointer to regs add r1, sp, #S_R0 + S_OFF @ pointer to regs
cmp scno, #NR_syscalls @ check upper syscall limit cmp scno, #NR_syscalls @ check upper syscall limit
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
1: mcount_get_lr r1 @ lr of instrumented func 1: mcount_get_lr r1 @ lr of instrumented func
mcount_adjust_addr r0, lr @ instrumented function mcount_adjust_addr r0, lr @ instrumented function
adr lr, BSYM(2f) badr lr, 2f
mov pc, r2 mov pc, r2
2: mcount_exit 2: mcount_exit
.endm .endm
......
...@@ -46,7 +46,7 @@ ENTRY(stext) ...@@ -46,7 +46,7 @@ ENTRY(stext)
.arm .arm
ENTRY(stext) ENTRY(stext)
THUMB( adr r9, BSYM(1f) ) @ Kernel is always entered in ARM. THUMB( badr r9, 1f ) @ Kernel is always entered in ARM.
THUMB( bx r9 ) @ If this is a Thumb-2 kernel, THUMB( bx r9 ) @ If this is a Thumb-2 kernel,
THUMB( .thumb ) @ switch to Thumb now. THUMB( .thumb ) @ switch to Thumb now.
THUMB(1: ) THUMB(1: )
...@@ -79,7 +79,7 @@ ENTRY(stext) ...@@ -79,7 +79,7 @@ ENTRY(stext)
#endif #endif
ldr r13, =__mmap_switched @ address to jump to after ldr r13, =__mmap_switched @ address to jump to after
@ initialising sctlr @ initialising sctlr
adr lr, BSYM(1f) @ return (PIC) address badr lr, 1f @ return (PIC) address
ldr r12, [r10, #PROCINFO_INITFUNC] ldr r12, [r10, #PROCINFO_INITFUNC]
add r12, r12, r10 add r12, r12, r10
ret r12 ret r12
...@@ -115,7 +115,7 @@ ENTRY(secondary_startup) ...@@ -115,7 +115,7 @@ ENTRY(secondary_startup)
bl __setup_mpu @ Initialize the MPU bl __setup_mpu @ Initialize the MPU
#endif #endif
adr lr, BSYM(__after_proc_init) @ return address badr lr, __after_proc_init @ return address
mov r13, r12 @ __secondary_switched address mov r13, r12 @ __secondary_switched address
ldr r12, [r10, #PROCINFO_INITFUNC] ldr r12, [r10, #PROCINFO_INITFUNC]
add r12, r12, r10 add r12, r12, r10
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
ENTRY(stext) ENTRY(stext)
ARM_BE8(setend be ) @ ensure we are in BE8 mode ARM_BE8(setend be ) @ ensure we are in BE8 mode
THUMB( adr r9, BSYM(1f) ) @ Kernel is always entered in ARM. THUMB( badr r9, 1f ) @ Kernel is always entered in ARM.
THUMB( bx r9 ) @ If this is a Thumb-2 kernel, THUMB( bx r9 ) @ If this is a Thumb-2 kernel,
THUMB( .thumb ) @ switch to Thumb now. THUMB( .thumb ) @ switch to Thumb now.
THUMB(1: ) THUMB(1: )
...@@ -148,7 +148,7 @@ ENTRY(stext) ...@@ -148,7 +148,7 @@ ENTRY(stext)
*/ */
ldr r13, =__mmap_switched @ address to jump to after ldr r13, =__mmap_switched @ address to jump to after
@ mmu has been enabled @ mmu has been enabled
adr lr, BSYM(1f) @ return (PIC) address badr lr, 1f @ return (PIC) address
#ifdef CONFIG_ARM_LPAE #ifdef CONFIG_ARM_LPAE
mov r5, #0 @ high TTBR0 mov r5, #0 @ high TTBR0
mov r8, r4, lsr #12 @ TTBR1 is swapper_pg_dir pfn mov r8, r4, lsr #12 @ TTBR1 is swapper_pg_dir pfn
...@@ -364,7 +364,7 @@ __turn_mmu_on_loc: ...@@ -364,7 +364,7 @@ __turn_mmu_on_loc:
.text .text
.arm .arm
ENTRY(secondary_startup_arm) ENTRY(secondary_startup_arm)
THUMB( adr r9, BSYM(1f) ) @ Kernel is entered in ARM. THUMB( badr r9, 1f ) @ Kernel is entered in ARM.
THUMB( bx r9 ) @ If this is a Thumb-2 kernel, THUMB( bx r9 ) @ If this is a Thumb-2 kernel,
THUMB( .thumb ) @ switch to Thumb now. THUMB( .thumb ) @ switch to Thumb now.
THUMB(1: ) THUMB(1: )
...@@ -400,7 +400,7 @@ ENTRY(secondary_startup) ...@@ -400,7 +400,7 @@ ENTRY(secondary_startup)
add r3, r7, lr add r3, r7, lr
ldrd r4, [r3, #0] @ get secondary_data.pgdir ldrd r4, [r3, #0] @ get secondary_data.pgdir
ldr r8, [r3, #8] @ get secondary_data.swapper_pg_dir ldr r8, [r3, #8] @ get secondary_data.swapper_pg_dir
adr lr, BSYM(__enable_mmu) @ return address badr lr, __enable_mmu @ return address
mov r13, r12 @ __secondary_switched address mov r13, r12 @ __secondary_switched address
ldr r12, [r10, #PROCINFO_INITFUNC] ldr r12, [r10, #PROCINFO_INITFUNC]
add r12, r12, r10 @ initialise processor add r12, r12, r10 @ initialise processor
......
...@@ -81,7 +81,7 @@ ENTRY(__cpu_suspend) ...@@ -81,7 +81,7 @@ ENTRY(__cpu_suspend)
mov r1, r4 @ size of save block mov r1, r4 @ size of save block
add r0, sp, #8 @ pointer to save block add r0, sp, #8 @ pointer to save block
bl __cpu_suspend_save bl __cpu_suspend_save
adr lr, BSYM(cpu_suspend_abort) badr lr, cpu_suspend_abort
ldmfd sp!, {r0, pc} @ call suspend fn ldmfd sp!, {r0, pc} @ call suspend fn
ENDPROC(__cpu_suspend) ENDPROC(__cpu_suspend)
.ltorg .ltorg
......
...@@ -309,7 +309,7 @@ ENTRY(kvm_call_hyp) ...@@ -309,7 +309,7 @@ ENTRY(kvm_call_hyp)
THUMB( orr r2, r2, #PSR_T_BIT ) THUMB( orr r2, r2, #PSR_T_BIT )
msr spsr_cxsf, r2 msr spsr_cxsf, r2
mrs r1, ELR_hyp mrs r1, ELR_hyp
ldr r2, =BSYM(panic) ldr r2, =panic
msr ELR_hyp, r2 msr ELR_hyp, r2
ldr r0, =\panic_str ldr r0, =\panic_str
clrex @ Clear exclusive monitor clrex @ Clear exclusive monitor
......
...@@ -35,7 +35,7 @@ ENTRY(call_with_stack) ...@@ -35,7 +35,7 @@ ENTRY(call_with_stack)
mov r2, r0 mov r2, r0
mov r0, r1 mov r0, r1
adr lr, BSYM(1f) badr lr, 1f
ret r2 ret r2
1: ldr lr, [sp] 1: ldr lr, [sp]
......
...@@ -98,7 +98,7 @@ __v7m_setup: ...@@ -98,7 +98,7 @@ __v7m_setup:
str r5, [r0, V7M_SCB_SHPR3] @ set PendSV priority str r5, [r0, V7M_SCB_SHPR3] @ set PendSV priority
@ SVC to run the kernel in this mode @ SVC to run the kernel in this mode
adr r1, BSYM(1f) badr r1, 1f
ldr r5, [r12, #11 * 4] @ read the SVC vector entry ldr r5, [r12, #11 * 4] @ read the SVC vector entry
str r1, [r12, #11 * 4] @ write the temporary SVC vector entry str r1, [r12, #11 * 4] @ write the temporary SVC vector entry
mov r6, lr @ save LR mov r6, lr @ save LR
......
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