• Manish Pandey's avatar
    PIE: make call to GDT relocation fixup generalized · da90359b
    Manish Pandey authored
    When a Firmware is complied as Position Independent Executable it needs
    to request GDT fixup by passing size of the memory region to
    el3_entrypoint_common macro.
    The Global descriptor table fixup will be done early on during cold boot
    process of primary core.
    
    Currently only BL31 supports PIE, but in future when BL2_AT_EL3 will be
    compiled as PIE, it can simply pass fixup size to the common el3
    entrypoint macro to fixup GDT.
    
    The reason for this patch was to overcome the bug introduced by SHA
    330ead80
    
     which called fixup routine for each core causing
    re-initializing of global pointers thus overwriting any changes
    done by the previous core.
    
    Change-Id: I55c792cc3ea9e7eef34c2e4653afd04572c4f055
    Signed-off-by: default avatarManish Pandey <manish.pandey2@arm.com>
    da90359b
bl1_entrypoint.S 2.19 KB
/*
 * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <arch.h>
#include <el3_common_macros.S>

	.globl	bl1_entrypoint


	/* -----------------------------------------------------
	 * bl1_entrypoint() is the entry point into the trusted
	 * firmware code when a cpu is released from warm or
	 * cold reset.
	 * -----------------------------------------------------
	 */

func bl1_entrypoint
	/* ---------------------------------------------------------------------
	 * If the reset address is programmable then bl1_entrypoint() is
	 * executed only on the cold boot path. Therefore, we can skip the warm
	 * boot mailbox mechanism.
	 * ---------------------------------------------------------------------
	 */
	el3_entrypoint_common					\
		_init_sctlr=1					\
		_warm_boot_mailbox=!PROGRAMMABLE_RESET_ADDRESS	\
		_secondary_cold_boot=!COLD_BOOT_SINGLE_CPU	\
		_init_memory=1					\
		_init_c_runtime=1				\
		_exception_vectors=bl1_exceptions		\
		_pie_fixup_size=0

	/* --------------------------------------------------------------------
	 * Perform BL1 setup
	 * --------------------------------------------------------------------
	 */
	bl	bl1_setup

#if ENABLE_PAUTH
	/* --------------------------------------------------------------------
	 * Program APIAKey_EL1 and enable pointer authentication.
	 * --------------------------------------------------------------------
	 */
	bl	pauth_init_enable_el3
#endif /* ENABLE_PAUTH */

	/* --------------------------------------------------------------------
	 * Initialize platform and jump to our c-entry point
	 * for this type of reset.
	 * --------------------------------------------------------------------
	 */
	bl	bl1_main

#if ENABLE_PAUTH
	/* --------------------------------------------------------------------
	 * Disable pointer authentication before jumping to next boot image.
	 * --------------------------------------------------------------------
	 */
	bl	pauth_disable_el3
#endif /* ENABLE_PAUTH */

	/* --------------------------------------------------
	 * Do the transition to next boot image.
	 * --------------------------------------------------
	 */
	b	el3_exit
endfunc bl1_entrypoint