wa_cve_2022_23960_bhb_vector.S 3.1 KB

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