aboutsummaryrefslogtreecommitdiff
path: root/arch/arm64/lib/call_with_stack.S
diff options
context:
space:
mode:
authorMeizu OpenSource <patchwork@meizu.com>2016-08-15 10:19:42 +0800
committerMeizu OpenSource <patchwork@meizu.com>2016-08-15 10:19:42 +0800
commitd2e1446d81725c351dc73a03b397ce043fb18452 (patch)
tree4dbc616b7f92aea39cd697a9084205ddb805e344 /arch/arm64/lib/call_with_stack.S
first commit
Diffstat (limited to 'arch/arm64/lib/call_with_stack.S')
-rw-r--r--arch/arm64/lib/call_with_stack.S31
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/arm64/lib/call_with_stack.S b/arch/arm64/lib/call_with_stack.S
new file mode 100644
index 000000000..6f527fe50
--- /dev/null
+++ b/arch/arm64/lib/call_with_stack.S
@@ -0,0 +1,31 @@
+/*
+ * arch/arm64/lib/call_with_stack.S
+ *
+ */
+
+#include <linux/linkage.h>
+#include <asm/assembler.h>
+
+/*
+ * void call_with_stack(void (*fn)(void *), void *arg, void *sp)
+ *
+ * Change the stack to that pointed at by sp, then invoke fn(arg) with
+ * the new stack.
+ */
+ENTRY(call_with_stack)
+ mov x3, sp
+ str x3, [x2, #-8]!
+ str lr, [x2, #-8]!
+
+ mov sp, x2
+ mov x2, x0
+ mov x0, x1
+
+ adr lr, 1f
+ br x2
+
+1: ldr lr, [sp]
+ ldr x3, [sp, #8]
+ mov sp, x3
+ br lr
+ENDPROC(call_with_stack)