ep_info.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (c) 2017-2021, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef EP_INFO_H
  7. #define EP_INFO_H
  8. #include <common/param_header.h>
  9. #ifndef __ASSEMBLER__
  10. #include <stdint.h>
  11. #include <lib/cassert.h>
  12. #endif /* __ASSEMBLER__ */
  13. #include <export/common/ep_info_exp.h>
  14. #define SECURE EP_SECURE
  15. #define NON_SECURE EP_NON_SECURE
  16. #define REALM EP_REALM
  17. #if ENABLE_RME
  18. #define sec_state_is_valid(s) (((s) == SECURE) || \
  19. ((s) == NON_SECURE) || \
  20. ((s) == REALM))
  21. #else
  22. #define sec_state_is_valid(s) (((s) == SECURE) || ((s) == NON_SECURE))
  23. #endif
  24. #define PARAM_EP_SECURITY_MASK EP_SECURITY_MASK
  25. #define NON_EXECUTABLE EP_NON_EXECUTABLE
  26. #define EXECUTABLE EP_EXECUTABLE
  27. /* Get/set security state of an image */
  28. #define GET_SECURITY_STATE(x) ((x) & EP_SECURITY_MASK)
  29. #define SET_SECURITY_STATE(x, security) \
  30. ((x) = ((x) & ~EP_SECURITY_MASK) | (security))
  31. #ifndef __ASSEMBLER__
  32. /*
  33. * Compile time assertions related to the 'entry_point_info' structure to
  34. * ensure that the assembler and the compiler view of the offsets of
  35. * the structure members is the same.
  36. */
  37. CASSERT(ENTRY_POINT_INFO_PC_OFFSET ==
  38. __builtin_offsetof(entry_point_info_t, pc), \
  39. assert_BL31_pc_offset_mismatch);
  40. #ifndef __aarch64__
  41. CASSERT(ENTRY_POINT_INFO_LR_SVC_OFFSET ==
  42. __builtin_offsetof(entry_point_info_t, lr_svc),
  43. assert_entrypoint_lr_offset_error);
  44. #endif
  45. CASSERT(ENTRY_POINT_INFO_ARGS_OFFSET == \
  46. __builtin_offsetof(entry_point_info_t, args), \
  47. assert_BL31_args_offset_mismatch);
  48. CASSERT(sizeof(uintptr_t) ==
  49. __builtin_offsetof(entry_point_info_t, spsr) - \
  50. __builtin_offsetof(entry_point_info_t, pc), \
  51. assert_entrypoint_and_spsr_should_be_adjacent);
  52. #endif /*__ASSEMBLER__*/
  53. #endif /* EP_INFO_H */