arm64: entry: Move the trampoline to be before PAN
The trampoline page tables are positioned after the early page tables in the kernel linker script. As we are about to change the early page table logic to resolve the swapper size at link time as opposed to compile time, the SWAPPER_DIR_SIZE variable (currently used to locate the trampline) will be rendered unsuitable for low level assembler. This patch solves this issue by moving the trampoline before the PAN page tables. The offset to the trampoline from ttbr1 can then be expressed by: PAGE_SIZE + RESERVED_TTBR0_SIZE, which is available to the entry assembler. Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Steve Capper <steve.capper@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
This commit is contained in:
parent
9dfe4828aa
commit
1e1b8c04fa
|
@ -990,7 +990,7 @@ __ni_sys_trace:
|
||||||
|
|
||||||
.macro tramp_map_kernel, tmp
|
.macro tramp_map_kernel, tmp
|
||||||
mrs \tmp, ttbr1_el1
|
mrs \tmp, ttbr1_el1
|
||||||
sub \tmp, \tmp, #(SWAPPER_DIR_SIZE + RESERVED_TTBR0_SIZE)
|
add \tmp, \tmp, #(PAGE_SIZE + RESERVED_TTBR0_SIZE)
|
||||||
bic \tmp, \tmp, #USER_ASID_FLAG
|
bic \tmp, \tmp, #USER_ASID_FLAG
|
||||||
msr ttbr1_el1, \tmp
|
msr ttbr1_el1, \tmp
|
||||||
#ifdef CONFIG_QCOM_FALKOR_ERRATUM_1003
|
#ifdef CONFIG_QCOM_FALKOR_ERRATUM_1003
|
||||||
|
@ -1009,7 +1009,7 @@ alternative_else_nop_endif
|
||||||
|
|
||||||
.macro tramp_unmap_kernel, tmp
|
.macro tramp_unmap_kernel, tmp
|
||||||
mrs \tmp, ttbr1_el1
|
mrs \tmp, ttbr1_el1
|
||||||
add \tmp, \tmp, #(SWAPPER_DIR_SIZE + RESERVED_TTBR0_SIZE)
|
sub \tmp, \tmp, #(PAGE_SIZE + RESERVED_TTBR0_SIZE)
|
||||||
orr \tmp, \tmp, #USER_ASID_FLAG
|
orr \tmp, \tmp, #USER_ASID_FLAG
|
||||||
msr ttbr1_el1, \tmp
|
msr ttbr1_el1, \tmp
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -218,6 +218,12 @@ SECTIONS
|
||||||
. = ALIGN(PAGE_SIZE);
|
. = ALIGN(PAGE_SIZE);
|
||||||
idmap_pg_dir = .;
|
idmap_pg_dir = .;
|
||||||
. += IDMAP_DIR_SIZE;
|
. += IDMAP_DIR_SIZE;
|
||||||
|
|
||||||
|
#ifdef CONFIG_UNMAP_KERNEL_AT_EL0
|
||||||
|
tramp_pg_dir = .;
|
||||||
|
. += PAGE_SIZE;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ARM64_SW_TTBR0_PAN
|
#ifdef CONFIG_ARM64_SW_TTBR0_PAN
|
||||||
reserved_ttbr0 = .;
|
reserved_ttbr0 = .;
|
||||||
. += RESERVED_TTBR0_SIZE;
|
. += RESERVED_TTBR0_SIZE;
|
||||||
|
@ -225,11 +231,6 @@ SECTIONS
|
||||||
swapper_pg_dir = .;
|
swapper_pg_dir = .;
|
||||||
. += SWAPPER_DIR_SIZE;
|
. += SWAPPER_DIR_SIZE;
|
||||||
|
|
||||||
#ifdef CONFIG_UNMAP_KERNEL_AT_EL0
|
|
||||||
tramp_pg_dir = .;
|
|
||||||
. += PAGE_SIZE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__pecoff_data_size = ABSOLUTE(. - __initdata_begin);
|
__pecoff_data_size = ABSOLUTE(. - __initdata_begin);
|
||||||
_end = .;
|
_end = .;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue