xref: /arm-trusted-firmware/lib/cpus/aarch64/wa_cve_2022_23960_bhb_vector.S (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700Schasinglulu/*
2*91f16700Schasinglulu * Copyright (c) 2022, Arm Limited. All rights reserved.
3*91f16700Schasinglulu *
4*91f16700Schasinglulu * SPDX-License-Identifier: BSD-3-Clause
5*91f16700Schasinglulu */
6*91f16700Schasinglulu
7*91f16700Schasinglulu#include <arch.h>
8*91f16700Schasinglulu#include <asm_macros.S>
9*91f16700Schasinglulu#include <services/arm_arch_svc.h>
10*91f16700Schasinglulu#include "wa_cve_2022_23960_bhb.S"
11*91f16700Schasinglulu
12*91f16700Schasinglulu	/*
13*91f16700Schasinglulu	 * This macro is used to isolate the vector table for relevant CPUs
14*91f16700Schasinglulu	 * used in the mitigation for CVE_2022_23960.
15*91f16700Schasinglulu	 */
16*91f16700Schasinglulu	.macro wa_cve_2022_23960_bhb_vector_table _bhb_loop_count, _cpu
17*91f16700Schasinglulu
18*91f16700Schasinglulu	.globl	wa_cve_vbar_\_cpu
19*91f16700Schasinglulu
20*91f16700Schasingluluvector_base wa_cve_vbar_\_cpu
21*91f16700Schasinglulu	/* ---------------------------------------------------------------------
22*91f16700Schasinglulu	 * Current EL with SP_EL0 : 0x0 - 0x200
23*91f16700Schasinglulu	 * ---------------------------------------------------------------------
24*91f16700Schasinglulu	 */
25*91f16700Schasingluluvector_entry bhb_sync_exception_sp_el0_\_cpu
26*91f16700Schasinglulu	b	sync_exception_sp_el0
27*91f16700Schasingluluend_vector_entry bhb_sync_exception_sp_el0_\_cpu
28*91f16700Schasinglulu
29*91f16700Schasingluluvector_entry bhb_irq_sp_el0_\_cpu
30*91f16700Schasinglulu	b	irq_sp_el0
31*91f16700Schasingluluend_vector_entry bhb_irq_sp_el0_\_cpu
32*91f16700Schasinglulu
33*91f16700Schasingluluvector_entry bhb_fiq_sp_el0_\_cpu
34*91f16700Schasinglulu	b	fiq_sp_el0
35*91f16700Schasingluluend_vector_entry bhb_fiq_sp_el0_\_cpu
36*91f16700Schasinglulu
37*91f16700Schasingluluvector_entry bhb_serror_sp_el0_\_cpu
38*91f16700Schasinglulu	b	serror_sp_el0
39*91f16700Schasingluluend_vector_entry bhb_serror_sp_el0_\_cpu
40*91f16700Schasinglulu
41*91f16700Schasinglulu	/* ---------------------------------------------------------------------
42*91f16700Schasinglulu	 * Current EL with SP_ELx: 0x200 - 0x400
43*91f16700Schasinglulu	 * ---------------------------------------------------------------------
44*91f16700Schasinglulu	 */
45*91f16700Schasingluluvector_entry bhb_sync_exception_sp_elx_\_cpu
46*91f16700Schasinglulu	b	sync_exception_sp_elx
47*91f16700Schasingluluend_vector_entry bhb_sync_exception_sp_elx_\_cpu
48*91f16700Schasinglulu
49*91f16700Schasingluluvector_entry bhb_irq_sp_elx_\_cpu
50*91f16700Schasinglulu	b	irq_sp_elx
51*91f16700Schasingluluend_vector_entry bhb_irq_sp_elx_\_cpu
52*91f16700Schasinglulu
53*91f16700Schasingluluvector_entry bhb_fiq_sp_elx_\_cpu
54*91f16700Schasinglulu	b	fiq_sp_elx
55*91f16700Schasingluluend_vector_entry bhb_fiq_sp_elx_\_cpu
56*91f16700Schasinglulu
57*91f16700Schasingluluvector_entry bhb_serror_sp_elx_\_cpu
58*91f16700Schasinglulu	b	serror_sp_elx
59*91f16700Schasingluluend_vector_entry bhb_serror_sp_elx_\_cpu
60*91f16700Schasinglulu
61*91f16700Schasinglulu	/* ---------------------------------------------------------------------
62*91f16700Schasinglulu	 * Lower EL using AArch64 : 0x400 - 0x600
63*91f16700Schasinglulu	 * ---------------------------------------------------------------------
64*91f16700Schasinglulu	 */
65*91f16700Schasingluluvector_entry bhb_sync_exception_aarch64_\_cpu
66*91f16700Schasinglulu	apply_cve_2022_23960_bhb_wa \_bhb_loop_count
67*91f16700Schasinglulu	b	sync_exception_aarch64
68*91f16700Schasingluluend_vector_entry bhb_sync_exception_aarch64_\_cpu
69*91f16700Schasinglulu
70*91f16700Schasingluluvector_entry bhb_irq_aarch64_\_cpu
71*91f16700Schasinglulu	apply_cve_2022_23960_bhb_wa \_bhb_loop_count
72*91f16700Schasinglulu	b	irq_aarch64
73*91f16700Schasingluluend_vector_entry bhb_irq_aarch64_\_cpu
74*91f16700Schasinglulu
75*91f16700Schasingluluvector_entry bhb_fiq_aarch64_\_cpu
76*91f16700Schasinglulu	apply_cve_2022_23960_bhb_wa \_bhb_loop_count
77*91f16700Schasinglulu	b	fiq_aarch64
78*91f16700Schasingluluend_vector_entry bhb_fiq_aarch64_\_cpu
79*91f16700Schasinglulu
80*91f16700Schasingluluvector_entry bhb_serror_aarch64_\_cpu
81*91f16700Schasinglulu	apply_cve_2022_23960_bhb_wa \_bhb_loop_count
82*91f16700Schasinglulu	b	serror_aarch64
83*91f16700Schasingluluend_vector_entry bhb_serror_aarch64_\_cpu
84*91f16700Schasinglulu
85*91f16700Schasinglulu	/* ---------------------------------------------------------------------
86*91f16700Schasinglulu	 * Lower EL using AArch32 : 0x600 - 0x800
87*91f16700Schasinglulu	 * ---------------------------------------------------------------------
88*91f16700Schasinglulu	 */
89*91f16700Schasingluluvector_entry bhb_sync_exception_aarch32_\_cpu
90*91f16700Schasinglulu	apply_cve_2022_23960_bhb_wa \_bhb_loop_count
91*91f16700Schasinglulu	b	sync_exception_aarch32
92*91f16700Schasingluluend_vector_entry bhb_sync_exception_aarch32_\_cpu
93*91f16700Schasinglulu
94*91f16700Schasingluluvector_entry bhb_irq_aarch32_\_cpu
95*91f16700Schasinglulu	apply_cve_2022_23960_bhb_wa \_bhb_loop_count
96*91f16700Schasinglulu	b	irq_aarch32
97*91f16700Schasingluluend_vector_entry bhb_irq_aarch32_\_cpu
98*91f16700Schasinglulu
99*91f16700Schasingluluvector_entry bhb_fiq_aarch32_\_cpu
100*91f16700Schasinglulu	apply_cve_2022_23960_bhb_wa \_bhb_loop_count
101*91f16700Schasinglulu	b	fiq_aarch32
102*91f16700Schasingluluend_vector_entry bhb_fiq_aarch32_\_cpu
103*91f16700Schasinglulu
104*91f16700Schasingluluvector_entry bhb_serror_aarch32_\_cpu
105*91f16700Schasinglulu	apply_cve_2022_23960_bhb_wa \_bhb_loop_count
106*91f16700Schasinglulu	b	serror_aarch32
107*91f16700Schasingluluend_vector_entry bhb_serror_aarch32_\_cpu
108*91f16700Schasinglulu	.endm
109