bl31_traps.c 764 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (c) 2022, ARM Limited. All rights reserved.
  3. * Copyright (c) 2023, NVIDIA Corporation. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: BSD-3-Clause
  6. *
  7. * Dispatch synchronous system register traps from lower ELs.
  8. */
  9. #include <bl31/sync_handle.h>
  10. #include <context.h>
  11. int handle_sysreg_trap(uint64_t esr_el3, cpu_context_t *ctx)
  12. {
  13. uint64_t __unused opcode = esr_el3 & ISS_SYSREG_OPCODE_MASK;
  14. #if ENABLE_FEAT_RNG_TRAP
  15. if ((opcode == ISS_SYSREG_OPCODE_RNDR) || (opcode == ISS_SYSREG_OPCODE_RNDRRS)) {
  16. return plat_handle_rng_trap(esr_el3, ctx);
  17. }
  18. #endif
  19. #if IMPDEF_SYSREG_TRAP
  20. if ((opcode & ISS_SYSREG_OPCODE_IMPDEF) == ISS_SYSREG_OPCODE_IMPDEF) {
  21. return plat_handle_impdef_trap(esr_el3, ctx);
  22. }
  23. #endif
  24. return TRAP_RET_UNHANDLED;
  25. }