cpu_data.S 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2016, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <asm_macros.S>
  7. #include <lib/el3_runtime/cpu_data.h>
  8. .globl _cpu_data
  9. .globl _cpu_data_by_index
  10. /* -----------------------------------------------------------------
  11. * cpu_data_t *_cpu_data(void)
  12. *
  13. * Return the cpu_data structure for the current CPU.
  14. * -----------------------------------------------------------------
  15. */
  16. func _cpu_data
  17. /* r12 is pushed to meet the 8 byte stack alignment requirement */
  18. push {r12, lr}
  19. bl plat_my_core_pos
  20. pop {r12, lr}
  21. b _cpu_data_by_index
  22. endfunc _cpu_data
  23. /* -----------------------------------------------------------------
  24. * cpu_data_t *_cpu_data_by_index(uint32_t cpu_index)
  25. *
  26. * Return the cpu_data structure for the CPU with given linear index
  27. *
  28. * This can be called without a valid stack.
  29. * clobbers: r0, r1
  30. * -----------------------------------------------------------------
  31. */
  32. func _cpu_data_by_index
  33. mov_imm r1, CPU_DATA_SIZE
  34. mul r0, r0, r1
  35. ldr r1, =percpu_data
  36. add r0, r0, r1
  37. bx lr
  38. endfunc _cpu_data_by_index