platform_mp_stack.S 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <arch.h>
  7. #include <asm_macros.S>
  8. #include <platform_def.h>
  9. .weak plat_get_my_stack
  10. .weak plat_set_my_stack
  11. /* -----------------------------------------------------
  12. * uintptr_t plat_get_my_stack (u_register_t mpidr)
  13. *
  14. * For a given CPU, this function returns the stack
  15. * pointer for a stack allocated in device memory.
  16. * -----------------------------------------------------
  17. */
  18. func plat_get_my_stack
  19. push {r4, lr}
  20. get_my_mp_stack platform_normal_stacks, PLATFORM_STACK_SIZE
  21. pop {r4, pc}
  22. endfunc plat_get_my_stack
  23. /* -----------------------------------------------------
  24. * void plat_set_my_stack ()
  25. *
  26. * For the current CPU, this function sets the stack
  27. * pointer to a stack allocated in normal memory.
  28. * -----------------------------------------------------
  29. */
  30. func plat_set_my_stack
  31. mov r4, lr
  32. get_my_mp_stack platform_normal_stacks, PLATFORM_STACK_SIZE
  33. mov sp, r0
  34. bx r4
  35. endfunc plat_set_my_stack
  36. /* -----------------------------------------------------
  37. * Per-cpu stacks in normal memory. Each cpu gets a
  38. * stack of PLATFORM_STACK_SIZE bytes.
  39. * -----------------------------------------------------
  40. */
  41. declare_stack platform_normal_stacks, .tzfw_normal_stacks, \
  42. PLATFORM_STACK_SIZE, PLATFORM_CORE_COUNT