arm64: asm: drop special versions of adr_l/ldr_l/str_l for modules
Now that we started keeping modules within 4 GB of the core kernel in all cases, we no longer need to special case the adr_l/ldr_l/str_l macros for modules to deal with them being loaded farther away. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Will Deacon <will.deacon@arm.com>
This commit is contained in:
parent
bd99f9a159
commit
350e1dad0d
1 changed files with 2 additions and 32 deletions
|
@ -202,25 +202,15 @@ lr .req x30 // link register
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pseudo-ops for PC-relative adr/ldr/str <reg>, <symbol> where
|
* Pseudo-ops for PC-relative adr/ldr/str <reg>, <symbol> where
|
||||||
* <symbol> is within the range +/- 4 GB of the PC when running
|
* <symbol> is within the range +/- 4 GB of the PC.
|
||||||
* in core kernel context. In module context, a movz/movk sequence
|
|
||||||
* is used, since modules may be loaded far away from the kernel
|
|
||||||
* when KASLR is in effect.
|
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* @dst: destination register (64 bit wide)
|
* @dst: destination register (64 bit wide)
|
||||||
* @sym: name of the symbol
|
* @sym: name of the symbol
|
||||||
*/
|
*/
|
||||||
.macro adr_l, dst, sym
|
.macro adr_l, dst, sym
|
||||||
#ifndef MODULE
|
|
||||||
adrp \dst, \sym
|
adrp \dst, \sym
|
||||||
add \dst, \dst, :lo12:\sym
|
add \dst, \dst, :lo12:\sym
|
||||||
#else
|
|
||||||
movz \dst, #:abs_g3:\sym
|
|
||||||
movk \dst, #:abs_g2_nc:\sym
|
|
||||||
movk \dst, #:abs_g1_nc:\sym
|
|
||||||
movk \dst, #:abs_g0_nc:\sym
|
|
||||||
#endif
|
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -231,7 +221,6 @@ lr .req x30 // link register
|
||||||
* the address
|
* the address
|
||||||
*/
|
*/
|
||||||
.macro ldr_l, dst, sym, tmp=
|
.macro ldr_l, dst, sym, tmp=
|
||||||
#ifndef MODULE
|
|
||||||
.ifb \tmp
|
.ifb \tmp
|
||||||
adrp \dst, \sym
|
adrp \dst, \sym
|
||||||
ldr \dst, [\dst, :lo12:\sym]
|
ldr \dst, [\dst, :lo12:\sym]
|
||||||
|
@ -239,15 +228,6 @@ lr .req x30 // link register
|
||||||
adrp \tmp, \sym
|
adrp \tmp, \sym
|
||||||
ldr \dst, [\tmp, :lo12:\sym]
|
ldr \dst, [\tmp, :lo12:\sym]
|
||||||
.endif
|
.endif
|
||||||
#else
|
|
||||||
.ifb \tmp
|
|
||||||
adr_l \dst, \sym
|
|
||||||
ldr \dst, [\dst]
|
|
||||||
.else
|
|
||||||
adr_l \tmp, \sym
|
|
||||||
ldr \dst, [\tmp]
|
|
||||||
.endif
|
|
||||||
#endif
|
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -257,28 +237,18 @@ lr .req x30 // link register
|
||||||
* while <src> needs to be preserved.
|
* while <src> needs to be preserved.
|
||||||
*/
|
*/
|
||||||
.macro str_l, src, sym, tmp
|
.macro str_l, src, sym, tmp
|
||||||
#ifndef MODULE
|
|
||||||
adrp \tmp, \sym
|
adrp \tmp, \sym
|
||||||
str \src, [\tmp, :lo12:\sym]
|
str \src, [\tmp, :lo12:\sym]
|
||||||
#else
|
|
||||||
adr_l \tmp, \sym
|
|
||||||
str \src, [\tmp]
|
|
||||||
#endif
|
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @dst: Result of per_cpu(sym, smp_processor_id()), can be SP for
|
* @dst: Result of per_cpu(sym, smp_processor_id()) (can be SP)
|
||||||
* non-module code
|
|
||||||
* @sym: The name of the per-cpu variable
|
* @sym: The name of the per-cpu variable
|
||||||
* @tmp: scratch register
|
* @tmp: scratch register
|
||||||
*/
|
*/
|
||||||
.macro adr_this_cpu, dst, sym, tmp
|
.macro adr_this_cpu, dst, sym, tmp
|
||||||
#ifndef MODULE
|
|
||||||
adrp \tmp, \sym
|
adrp \tmp, \sym
|
||||||
add \dst, \tmp, #:lo12:\sym
|
add \dst, \tmp, #:lo12:\sym
|
||||||
#else
|
|
||||||
adr_l \dst, \sym
|
|
||||||
#endif
|
|
||||||
alternative_if_not ARM64_HAS_VIRT_HOST_EXTN
|
alternative_if_not ARM64_HAS_VIRT_HOST_EXTN
|
||||||
mrs \tmp, tpidr_el1
|
mrs \tmp, tpidr_el1
|
||||||
alternative_else
|
alternative_else
|
||||||
|
|
Loading…
Reference in a new issue