xref: /original-bsd/lib/libc/tahoe/gen/alloca.s (revision 967dd0d9)
1d5e4728dSbostic/*
2*967dd0d9Sbostic * Copyright (c) 1988, 1993
3*967dd0d9Sbostic *	The Regents of the University of California.  All rights reserved.
4d5e4728dSbostic *
5d5e4728dSbostic * This code is derived from software contributed to Berkeley by
6d5e4728dSbostic * Computer Consoles Inc.
7eaffa01aSbostic *
8eaffa01aSbostic * %sccs.include.redist.c%
9d5e4728dSbostic */
10d5e4728dSbostic
11d5e4728dSbostic#if defined(LIBC_SCCS) && !defined(lint)
12*967dd0d9Sbostic	.asciz "@(#)alloca.s	8.1 (Berkeley) 06/04/93"
13d5e4728dSbostic#endif /* LIBC_SCCS and not lint */
145359d151Ssam
155359d151Ssam/* like alloc, but automatic automatic free in return */
165359d151Ssam
175359d151Ssam#include "DEFS.h"
185359d151Ssam
195359d151SsamENTRY(alloca, 0)
205359d151Ssam	moval	(sp),r0		# current sp
215359d151Ssam	subl2	4(fp),r0	# allocation size
225359d151Ssam	andl2	$0xfffffffc,r0	# allignment
235359d151Ssam	movl	-8(fp),r1	# old pc
245359d151Ssam	movl	(fp),fp		# old fp
255359d151Ssam	addl2	$4*4,r0		# reuse space of mscp
265359d151Ssam	movl	r0,sp		# new sp
275359d151Ssam	jmp 	(r1)		# funny return
28