Commit 79999040 authored by Soby Mathew's avatar Soby Mathew Committed by TrustedFirmware Code Review
Browse files

Merge "PIE: make call to GDT relocation fixup generalized" into integration

parents fcccd358 da90359b
...@@ -30,7 +30,8 @@ func bl1_entrypoint ...@@ -30,7 +30,8 @@ func bl1_entrypoint
_secondary_cold_boot=!COLD_BOOT_SINGLE_CPU \ _secondary_cold_boot=!COLD_BOOT_SINGLE_CPU \
_init_memory=1 \ _init_memory=1 \
_init_c_runtime=1 \ _init_c_runtime=1 \
_exception_vectors=bl1_exceptions _exception_vectors=bl1_exceptions \
_pie_fixup_size=0
/* -------------------------------------------------------------------- /* --------------------------------------------------------------------
* Perform BL1 setup * Perform BL1 setup
......
...@@ -26,7 +26,8 @@ func bl2_entrypoint ...@@ -26,7 +26,8 @@ func bl2_entrypoint
_secondary_cold_boot=!COLD_BOOT_SINGLE_CPU \ _secondary_cold_boot=!COLD_BOOT_SINGLE_CPU \
_init_memory=1 \ _init_memory=1 \
_init_c_runtime=1 \ _init_c_runtime=1 \
_exception_vectors=bl2_el3_exceptions _exception_vectors=bl2_el3_exceptions \
_pie_fixup_size=0
/* --------------------------------------------- /* ---------------------------------------------
* Restore parameters of boot rom * Restore parameters of boot rom
......
...@@ -32,17 +32,6 @@ func bl31_entrypoint ...@@ -32,17 +32,6 @@ func bl31_entrypoint
mov x22, x2 mov x22, x2
mov x23, x3 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 #if !RESET_TO_BL31
/* --------------------------------------------------------------------- /* ---------------------------------------------------------------------
* For !RESET_TO_BL31 systems, only the primary CPU ever reaches * For !RESET_TO_BL31 systems, only the primary CPU ever reaches
...@@ -59,7 +48,8 @@ func bl31_entrypoint ...@@ -59,7 +48,8 @@ func bl31_entrypoint
_secondary_cold_boot=0 \ _secondary_cold_boot=0 \
_init_memory=0 \ _init_memory=0 \
_init_c_runtime=1 \ _init_c_runtime=1 \
_exception_vectors=runtime_exceptions _exception_vectors=runtime_exceptions \
_pie_fixup_size=BL31_LIMIT - BL31_BASE
#else #else
/* --------------------------------------------------------------------- /* ---------------------------------------------------------------------
...@@ -74,7 +64,8 @@ func bl31_entrypoint ...@@ -74,7 +64,8 @@ func bl31_entrypoint
_secondary_cold_boot=!COLD_BOOT_SINGLE_CPU \ _secondary_cold_boot=!COLD_BOOT_SINGLE_CPU \
_init_memory=1 \ _init_memory=1 \
_init_c_runtime=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 * For RESET_TO_BL31 systems, BL31 is the first bootloader to run so
...@@ -174,7 +165,8 @@ func bl31_warm_entrypoint ...@@ -174,7 +165,8 @@ func bl31_warm_entrypoint
_secondary_cold_boot=0 \ _secondary_cold_boot=0 \
_init_memory=0 \ _init_memory=0 \
_init_c_runtime=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. * We're about to enable MMU and participate in PSCI state coordination.
......
...@@ -232,11 +232,18 @@ ...@@ -232,11 +232,18 @@
* *
* _exception_vectors: * _exception_vectors:
* Address of the exception vectors to program in the VBAR_EL3 register. * 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 \ .macro el3_entrypoint_common \
_init_sctlr, _warm_boot_mailbox, _secondary_cold_boot, \ _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 .if \_init_sctlr
/* ------------------------------------------------------------- /* -------------------------------------------------------------
...@@ -283,6 +290,26 @@ ...@@ -283,6 +290,26 @@
do_cold_boot: do_cold_boot:
.endif /* _warm_boot_mailbox */ .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. * Set the exception vectors.
* --------------------------------------------------------------------- * ---------------------------------------------------------------------
......
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