Skip to content

Commit

Permalink
ARM: 8314/1: replace PROCINFO embedded branch with relative offset
Browse files Browse the repository at this point in the history
This patch replaces the 'branch to setup()' instructions embedded
in the PROCINFO structs with the offset to that setup function
relative to the base of the struct. This preserves the position
independent nature of that field, but uses a data item rather
than an instruction.

This is mainly done to prevent linker failures on large kernels,
where the setup function is out of reach for the branch.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Ard Biesheuvel authored and Russell King committed Mar 28, 2015
1 parent 0a6a78b commit bf35706
Show file tree
Hide file tree
Showing 26 changed files with 72 additions and 67 deletions.
14 changes: 7 additions & 7 deletions arch/arm/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ ENTRY(stext)
@ mmu has been enabled
adr lr, BSYM(1f) @ return (PIC) address
mov r8, r4 @ set TTBR1 to swapper_pg_dir
ARM( add pc, r10, #PROCINFO_INITFUNC )
THUMB( add r12, r10, #PROCINFO_INITFUNC )
THUMB( ret r12 )
ldr r12, [r10, #PROCINFO_INITFUNC]
add r12, r12, r10
ret r12
1: b __enable_mmu
ENDPROC(stext)
.ltorg
Expand Down Expand Up @@ -386,10 +386,10 @@ ENTRY(secondary_startup)
ldr r8, [r7, lr] @ get secondary_data.swapper_pg_dir
adr lr, BSYM(__enable_mmu) @ return address
mov r13, r12 @ __secondary_switched address
ARM( add pc, r10, #PROCINFO_INITFUNC ) @ initialise processor
@ (return control reg)
THUMB( add r12, r10, #PROCINFO_INITFUNC )
THUMB( ret r12 )
ldr r12, [r10, #PROCINFO_INITFUNC]
add r12, r12, r10 @ initialise processor
@ (return control reg)
ret r12
ENDPROC(secondary_startup)
ENDPROC(secondary_startup_arm)

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-arm1020.S
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ cpu_arm1020_name:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.type __arm1020_proc_info,#object
__arm1020_proc_info:
Expand All @@ -519,7 +519,7 @@ __arm1020_proc_info:
.long PMD_TYPE_SECT | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
b __arm1020_setup
initfn __arm1020_setup, __arm1020_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-arm1020e.S
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ arm1020e_crval:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.type __arm1020e_proc_info,#object
__arm1020e_proc_info:
Expand All @@ -479,7 +479,7 @@ __arm1020e_proc_info:
PMD_BIT4 | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
b __arm1020e_setup
initfn __arm1020e_setup, __arm1020e_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB | HWCAP_EDSP
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-arm1022.S
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ arm1022_crval:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.type __arm1022_proc_info,#object
__arm1022_proc_info:
Expand All @@ -462,7 +462,7 @@ __arm1022_proc_info:
PMD_BIT4 | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
b __arm1022_setup
initfn __arm1022_setup, __arm1022_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB | HWCAP_EDSP
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-arm1026.S
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ arm1026_crval:
string cpu_arm1026_name, "ARM1026EJ-S"
.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.type __arm1026_proc_info,#object
__arm1026_proc_info:
Expand All @@ -456,7 +456,7 @@ __arm1026_proc_info:
PMD_BIT4 | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
b __arm1026_setup
initfn __arm1026_setup, __arm1026_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_JAVA
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-arm720.S
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ arm720_crval:
* See <asm/procinfo.h> for a definition of this structure.
*/

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.macro arm720_proc_info name:req, cpu_val:req, cpu_mask:req, cpu_name:req, cpu_flush:req
.type __\name\()_proc_info,#object
Expand All @@ -203,7 +203,7 @@ __\name\()_proc_info:
PMD_BIT4 | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
b \cpu_flush @ cpu_flush
initfn \cpu_flush, __\name\()_proc_info @ cpu_flush
.long cpu_arch_name @ arch_name
.long cpu_elf_name @ elf_name
.long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-arm740.S
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ __arm740_setup:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc
.type __arm740_proc_info,#object
__arm740_proc_info:
.long 0x41807400
.long 0xfffffff0
.long 0
.long 0
b __arm740_setup
initfn __arm740_setup, __arm740_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB | HWCAP_26BIT
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-arm7tdmi.S
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ __arm7tdmi_setup:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.macro arm7tdmi_proc_info name:req, cpu_val:req, cpu_mask:req, cpu_name:req, \
extra_hwcaps=0
Expand All @@ -86,7 +86,7 @@ __\name\()_proc_info:
.long \cpu_mask
.long 0
.long 0
b __arm7tdmi_setup
initfn __arm7tdmi_setup, __\name\()_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP | HWCAP_26BIT | ( \extra_hwcaps )
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-arm920.S
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ arm920_crval:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.type __arm920_proc_info,#object
__arm920_proc_info:
Expand All @@ -464,7 +464,7 @@ __arm920_proc_info:
PMD_BIT4 | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
b __arm920_setup
initfn __arm920_setup, __arm920_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-arm922.S
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ arm922_crval:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.type __arm922_proc_info,#object
__arm922_proc_info:
Expand All @@ -442,7 +442,7 @@ __arm922_proc_info:
PMD_BIT4 | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
b __arm922_setup
initfn __arm922_setup, __arm922_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-arm925.S
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ arm925_crval:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.macro arm925_proc_info name:req, cpu_val:req, cpu_mask:req, cpu_name:req, cache
.type __\name\()_proc_info,#object
Expand All @@ -510,7 +510,7 @@ __\name\()_proc_info:
PMD_BIT4 | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
b __arm925_setup
initfn __arm925_setup, __\name\()_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-arm926.S
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ arm926_crval:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.type __arm926_proc_info,#object
__arm926_proc_info:
Expand All @@ -490,7 +490,7 @@ __arm926_proc_info:
PMD_BIT4 | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
b __arm926_setup
initfn __arm926_setup, __arm926_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_JAVA
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-arm940.S
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,14 @@ __arm940_setup:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.type __arm940_proc_info,#object
__arm940_proc_info:
.long 0x41009400
.long 0xff00fff0
.long 0
b __arm940_setup
initfn __arm940_setup, __arm940_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-arm946.S
Original file line number Diff line number Diff line change
Expand Up @@ -409,14 +409,14 @@ __arm946_setup:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc
.type __arm946_proc_info,#object
__arm946_proc_info:
.long 0x41009460
.long 0xff00fff0
.long 0
.long 0
b __arm946_setup
initfn __arm946_setup, __arm946_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-arm9tdmi.S
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ __arm9tdmi_setup:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.macro arm9tdmi_proc_info name:req, cpu_val:req, cpu_mask:req, cpu_name:req
.type __\name\()_proc_info, #object
Expand All @@ -79,7 +79,7 @@ __\name\()_proc_info:
.long \cpu_mask
.long 0
.long 0
b __arm9tdmi_setup
initfn __arm9tdmi_setup, __\name\()_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP | HWCAP_THUMB | HWCAP_26BIT
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-fa526.S
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ fa526_cr1_set:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.type __fa526_proc_info,#object
__fa526_proc_info:
Expand All @@ -206,7 +206,7 @@ __fa526_proc_info:
PMD_BIT4 | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
b __fa526_setup
initfn __fa526_setup, __fa526_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP | HWCAP_HALF
Expand Down
5 changes: 3 additions & 2 deletions arch/arm/mm/proc-feroceon.S
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ feroceon_crval:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.macro feroceon_proc_info name:req, cpu_val:req, cpu_mask:req, cpu_name:req, cache:req
.type __\name\()_proc_info,#object
Expand All @@ -601,7 +601,8 @@ __\name\()_proc_info:
PMD_BIT4 | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
b __feroceon_setup
initfn __feroceon_setup, __\name\()_proc_info
.long __feroceon_setup
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mm/proc-macros.S
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,7 @@ ENTRY(\name\()_tlb_fns)
.globl \x
.equ \x, \y
.endm

.macro initfn, func, base
.long \func - \base
.endm
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-mohawk.S
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ mohawk_crval:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.type __88sv331x_proc_info,#object
__88sv331x_proc_info:
Expand All @@ -443,7 +443,7 @@ __88sv331x_proc_info:
PMD_BIT4 | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
b __mohawk_setup
initfn __mohawk_setup, __88sv331x_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-sa110.S
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ sa110_crval:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.type __sa110_proc_info,#object
__sa110_proc_info:
Expand All @@ -213,7 +213,7 @@ __sa110_proc_info:
.long PMD_TYPE_SECT | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
b __sa110_setup
initfn __sa110_setup, __sa110_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT | HWCAP_FAST_MULT
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-sa1100.S
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ sa1100_crval:

.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

.macro sa1100_proc_info name:req, cpu_val:req, cpu_mask:req, cpu_name:req
.type __\name\()_proc_info,#object
Expand All @@ -257,7 +257,7 @@ __\name\()_proc_info:
.long PMD_TYPE_SECT | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
b __sa1100_setup
initfn __sa1100_setup, __\name\()_proc_info
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT | HWCAP_FAST_MULT
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mm/proc-v6.S
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ v6_crval:
string cpu_elf_name, "v6"
.align

.section ".proc.info.init", #alloc, #execinstr
.section ".proc.info.init", #alloc

/*
* Match any ARMv6 processor core.
Expand All @@ -287,7 +287,7 @@ __v6_proc_info:
PMD_SECT_XN | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
b __v6_setup
initfn __v6_setup, __v6_proc_info
.long cpu_arch_name
.long cpu_elf_name
/* See also feat_v6_fixup() for HWCAP_TLS */
Expand Down
Loading

0 comments on commit bf35706

Please sign in to comment.