spm_common.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) 2017-2023, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef SPM_COMMON_H
  7. #define SPM_COMMON_H
  8. #include <context.h>
  9. /*******************************************************************************
  10. * Constants that allow assembler code to preserve callee-saved registers of the
  11. * C runtime context while performing a security state switch.
  12. ******************************************************************************/
  13. #define SP_C_RT_CTX_X19 0x0
  14. #define SP_C_RT_CTX_X20 0x8
  15. #define SP_C_RT_CTX_X21 0x10
  16. #define SP_C_RT_CTX_X22 0x18
  17. #define SP_C_RT_CTX_X23 0x20
  18. #define SP_C_RT_CTX_X24 0x28
  19. #define SP_C_RT_CTX_X25 0x30
  20. #define SP_C_RT_CTX_X26 0x38
  21. #define SP_C_RT_CTX_X27 0x40
  22. #define SP_C_RT_CTX_X28 0x48
  23. #define SP_C_RT_CTX_X29 0x50
  24. #define SP_C_RT_CTX_X30 0x58
  25. #define SP_C_RT_CTX_SIZE 0x60
  26. #define SP_C_RT_CTX_ENTRIES (SP_C_RT_CTX_SIZE >> DWORD_SHIFT)
  27. #ifndef __ASSEMBLER__
  28. #include <stdint.h>
  29. #include <lib/xlat_tables/xlat_tables_v2.h>
  30. /* Assembly helpers */
  31. uint64_t spm_secure_partition_enter(uint64_t *c_rt_ctx);
  32. void __dead2 spm_secure_partition_exit(uint64_t c_rt_ctx, uint64_t ret);
  33. /* Helper to obtain a reference to the SP's translation table context */
  34. xlat_ctx_t *spm_get_sp_xlat_context(void);
  35. #endif /* __ASSEMBLER__ */
  36. #endif /* SPM_COMMON_H */