summaryrefslogtreecommitdiff
path: root/lib/libc/arch/amd64/gen/alloca.S
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/arch/amd64/gen/alloca.S')
-rw-r--r--lib/libc/arch/amd64/gen/alloca.S13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/libc/arch/amd64/gen/alloca.S b/lib/libc/arch/amd64/gen/alloca.S
new file mode 100644
index 00000000000..8c15583012c
--- /dev/null
+++ b/lib/libc/arch/amd64/gen/alloca.S
@@ -0,0 +1,13 @@
+/* $OpenBSD: alloca.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */
+/* $NetBSD: alloca.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */
+
+#include <machine/asm.h>
+
+ENTRY(alloca)
+ popq %rdx
+ movq %rsp,%rcx
+ addq $15,%rdi /* round up to 16 bytes */
+ andq $~15,%rdi
+ subq %rdi,%rsp
+ movq %rsp,%rax
+ jmp *%rdx