summaryrefslogtreecommitdiff
path: root/include/asm_macros.S
diff options
context:
space:
mode:
authordanh-arm <dan.handley@arm.com>2014-04-16 15:29:03 +0100
committerdanh-arm <dan.handley@arm.com>2014-04-16 15:29:03 +0100
commit7640b47342eb779c92cf011b532168fa3ea0d99b (patch)
treec35374e36508ddf0c10324e9b511c983655213e4 /include/asm_macros.S
parent9c2c763d22469b0f73d76469442b474c08497e7a (diff)
parent2bf28e620a6f05700753a2b45a888c6623e20723 (diff)
Merge pull request #40 from athoelke/at/up-stacks-76-v2
Allocate single stacks for BL1 and BL2 (v2)
Diffstat (limited to 'include/asm_macros.S')
-rw-r--r--include/asm_macros.S40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/asm_macros.S b/include/asm_macros.S
index 135c11a6..8bcb7d28 100644
--- a/include/asm_macros.S
+++ b/include/asm_macros.S
@@ -91,3 +91,43 @@
.type \_name, %function
\_name:
.endm
+
+ /*
+ * This macro declares an array of 1 or more stacks, properly
+ * aligned and in the requested section
+ */
+#define STACK_ALIGN 6
+
+ .macro declare_stack _name, _section, _size, _count
+ .if ((\_size & ((1 << STACK_ALIGN) - 1)) <> 0)
+ .error "Stack size not correctly aligned"
+ .endif
+ .section \_section, "aw", %nobits
+ .align STACK_ALIGN
+ \_name:
+ .space ((\_count) * (\_size)), 0
+ .endm
+
+ /*
+ * This macro calculates the base address of an MP stack using the
+ * platform_get_core_pos() index, the name of the stack storage and
+ * the size of each stack
+ * In: X0 = MPIDR of CPU whose stack is wanted
+ * Out: X0 = physical address of stack base
+ * Clobber: X30, X1, X2
+ */
+ .macro get_mp_stack _name, _size
+ bl platform_get_core_pos
+ ldr x2, =(\_name + \_size)
+ mov x1, #\_size
+ madd x0, x0, x1, x2
+ .endm
+
+ /*
+ * This macro calculates the base address of a UP stack using the
+ * name of the stack storage and the size of the stack
+ * Out: X0 = physical address of stack base
+ */
+ .macro get_up_stack _name, _size
+ ldr x0, =(\_name + \_size)
+ .endm