xref: /minix/lib/libc/arch/x86_64/gen/alloca.S (revision 0a6a1f1d)
1/*	$NetBSD: alloca.S,v 1.2 2014/05/22 15:01:56 uebayasi Exp $	*/
2
3#include <machine/asm.h>
4
5#if defined(LIBC_SCCS)
6	RCSID("$NetBSD: alloca.S,v 1.2 2014/05/22 15:01:56 uebayasi Exp $")
7#endif
8
9ENTRY(alloca)
10	popq	%rdx
11	movq	%rsp,%rcx
12	addq	$15,%rdi	/*  round up to 16 bytes */
13	andq	$~15,%rdi
14	subq	%rdi,%rsp
15	movq	%rsp,%rax
16	jmp	*%rdx
17END(alloca)
18