2 * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved.
4 * SPDX-License-Identifier: BSD-3-Clause
8 #include <asm_macros.S>
9 #include <common/bl_common.h>
11 .globl bl2_vector_table
15 vector_base bl2_vector_table
17 b report_exception /* Undef */
18 b report_exception /* SVC call */
19 b report_exception /* Prefetch abort */
20 b report_exception /* Data abort */
21 b report_exception /* Reserved */
22 b report_exception /* IRQ */
23 b report_exception /* FIQ */
27 /*---------------------------------------------
28 * Save arguments x0 - x3 from BL1 for future
30 * ---------------------------------------------
37 /* ---------------------------------------------
38 * Set the exception vector to something sane.
39 * ---------------------------------------------
41 ldr r0, =bl2_vector_table
45 /* --------------------------------------------------------
46 * Enable the instruction cache - disable speculative loads
47 * --------------------------------------------------------
50 orr r0, r0, #SCTLR_I_BIT
51 bic r0, r0, #SCTLR_DSSBS_BIT
55 /* ---------------------------------------------
56 * Since BL2 executes after BL1, it is assumed
57 * here that BL1 has already has done the
58 * necessary register initializations.
59 * ---------------------------------------------
62 /* ---------------------------------------------
63 * Invalidate the RW memory used by the BL2
64 * image. This includes the data and NOBITS
65 * sections. This is done to safeguard against
66 * possible corruption of this memory by dirty
67 * cache lines in a system cache as a result of
68 * use by an earlier boot loader stage.
69 * ---------------------------------------------
76 /* ---------------------------------------------
77 * Zero out NOBITS sections. There are 2 of them:
79 * - the coherent memory section.
80 * ---------------------------------------------
82 ldr r0, =__BSS_START__
87 ldr r0, =__COHERENT_RAM_START__
88 ldr r1, =__COHERENT_RAM_UNALIGNED_SIZE__
92 /* --------------------------------------------
93 * Allocate a stack whose memory will be marked
94 * as Normal-IS-WBWA when the MMU is enabled.
95 * There is no risk of reading stale stack
96 * memory after enabling the MMU as only the
97 * primary cpu is running at the moment.
98 * --------------------------------------------
102 /* ---------------------------------------------
103 * Initialize the stack protector canary before
104 * any C code is called.
105 * ---------------------------------------------
107 #if STACK_PROTECTOR_ENABLED
108 bl update_stack_protector_canary
111 /* ---------------------------------------------
113 * ---------------------------------------------
122 /* ---------------------------------------------
123 * Jump to main function.
124 * ---------------------------------------------
128 /* ---------------------------------------------
129 * Should never reach this point.
130 * ---------------------------------------------
132 no_ret plat_panic_handler
134 endfunc bl2_entrypoint