xref: /original-bsd/lib/libc/hp300/gen/alloca.s (revision c3e32dec)
1/*-
2 * Copyright (c) 1990, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * the Systems Programming Group of the University of Utah Computer
7 * Science Department.
8 *
9 * %sccs.include.redist.c%
10 */
11
12#if defined(LIBC_SCCS) && !defined(lint)
13	.asciz "@(#)alloca.s	8.1 (Berkeley) 06/04/93"
14#endif /* LIBC_SCCS and not lint */
15
16/* like alloc, but automatic free in return */
17
18#include "DEFS.h"
19
20ENTRY(alloca)
21	movl	sp@,a0		/* save return addr */
22	movl	sp,d0		/* get current SP value */
23	subl	sp@(4),d0	/* allocate requested space */
24	andb	#~3,d0		/* longword align for efficiency */
25	addql	#8,d0		/* reuse space of call frame */
26	movl	d0,sp		/* set new SP value */
27	lea	sp@(-4),sp	/* account for argument pop in caller */
28	jmp 	a0@		/* funny return */
29