mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 09:34:18 +00:00
Merge "PIE: make call to GDT relocation fixup generalized" into integration
This commit is contained in:
commit
7999904074
4 changed files with 38 additions and 17 deletions
|
@ -30,7 +30,8 @@ func bl1_entrypoint
|
|||
_secondary_cold_boot=!COLD_BOOT_SINGLE_CPU \
|
||||
_init_memory=1 \
|
||||
_init_c_runtime=1 \
|
||||
_exception_vectors=bl1_exceptions
|
||||
_exception_vectors=bl1_exceptions \
|
||||
_pie_fixup_size=0
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* Perform BL1 setup
|
||||
|
|
|
@ -26,7 +26,8 @@ func bl2_entrypoint
|
|||
_secondary_cold_boot=!COLD_BOOT_SINGLE_CPU \
|
||||
_init_memory=1 \
|
||||
_init_c_runtime=1 \
|
||||
_exception_vectors=bl2_el3_exceptions
|
||||
_exception_vectors=bl2_el3_exceptions \
|
||||
_pie_fixup_size=0
|
||||
|
||||
/* ---------------------------------------------
|
||||
* Restore parameters of boot rom
|
||||
|
|
|
@ -32,17 +32,6 @@ func bl31_entrypoint
|
|||
mov x22, x2
|
||||
mov x23, x3
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* If PIE is enabled, fixup the Global descriptor Table and dynamic
|
||||
* relocations
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
#if ENABLE_PIE
|
||||
mov_imm x0, BL31_BASE
|
||||
mov_imm x1, BL31_LIMIT
|
||||
bl fixup_gdt_reloc
|
||||
#endif /* ENABLE_PIE */
|
||||
|
||||
#if !RESET_TO_BL31
|
||||
/* ---------------------------------------------------------------------
|
||||
* For !RESET_TO_BL31 systems, only the primary CPU ever reaches
|
||||
|
@ -59,7 +48,8 @@ func bl31_entrypoint
|
|||
_secondary_cold_boot=0 \
|
||||
_init_memory=0 \
|
||||
_init_c_runtime=1 \
|
||||
_exception_vectors=runtime_exceptions
|
||||
_exception_vectors=runtime_exceptions \
|
||||
_pie_fixup_size=BL31_LIMIT - BL31_BASE
|
||||
#else
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
|
@ -74,7 +64,8 @@ func bl31_entrypoint
|
|||
_secondary_cold_boot=!COLD_BOOT_SINGLE_CPU \
|
||||
_init_memory=1 \
|
||||
_init_c_runtime=1 \
|
||||
_exception_vectors=runtime_exceptions
|
||||
_exception_vectors=runtime_exceptions \
|
||||
_pie_fixup_size=BL31_LIMIT - BL31_BASE
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* For RESET_TO_BL31 systems, BL31 is the first bootloader to run so
|
||||
|
@ -174,7 +165,8 @@ func bl31_warm_entrypoint
|
|||
_secondary_cold_boot=0 \
|
||||
_init_memory=0 \
|
||||
_init_c_runtime=0 \
|
||||
_exception_vectors=runtime_exceptions
|
||||
_exception_vectors=runtime_exceptions \
|
||||
_pie_fixup_size=0
|
||||
|
||||
/*
|
||||
* We're about to enable MMU and participate in PSCI state coordination.
|
||||
|
|
|
@ -232,11 +232,18 @@
|
|||
*
|
||||
* _exception_vectors:
|
||||
* Address of the exception vectors to program in the VBAR_EL3 register.
|
||||
*
|
||||
* _pie_fixup_size:
|
||||
* Size of memory region to fixup Global Descriptor Table (GDT).
|
||||
*
|
||||
* A non-zero value is expected when firmware needs GDT to be fixed-up.
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
.macro el3_entrypoint_common \
|
||||
_init_sctlr, _warm_boot_mailbox, _secondary_cold_boot, \
|
||||
_init_memory, _init_c_runtime, _exception_vectors
|
||||
_init_memory, _init_c_runtime, _exception_vectors, \
|
||||
_pie_fixup_size
|
||||
|
||||
.if \_init_sctlr
|
||||
/* -------------------------------------------------------------
|
||||
|
@ -283,6 +290,26 @@
|
|||
do_cold_boot:
|
||||
.endif /* _warm_boot_mailbox */
|
||||
|
||||
.if \_pie_fixup_size
|
||||
#if ENABLE_PIE
|
||||
/*
|
||||
* ------------------------------------------------------------
|
||||
* If PIE is enabled fixup the Global descriptor Table only
|
||||
* once during primary core cold boot path.
|
||||
*
|
||||
* Compile time base address, required for fixup, is calculated
|
||||
* using "pie_fixup" label present within first page.
|
||||
* ------------------------------------------------------------
|
||||
*/
|
||||
pie_fixup:
|
||||
ldr x0, =pie_fixup
|
||||
and x0, x0, #~(PAGE_SIZE - 1)
|
||||
mov_imm x1, \_pie_fixup_size
|
||||
add x1, x1, x0
|
||||
bl fixup_gdt_reloc
|
||||
#endif /* ENABLE_PIE */
|
||||
.endif /* _pie_fixup_size */
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Set the exception vectors.
|
||||
* ---------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Reference in a new issue