summaryrefslogtreecommitdiff
path: root/lib/libc/arch/amd64/gen/alloca.S
blob: 8c15583012c905cec7741c6a7c7be3d5bb05d8dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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