1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * 8 * %sccs.include.redist.c% 9 */ 10 11#if defined(LIBC_SCCS) && !defined(lint) 12 .asciz "@(#)alloca.s 5.1 (Berkeley) 04/23/90" 13#endif /* LIBC_SCCS and not lint */ 14 15/* like alloc, but automatic automatic free in return */ 16 17#include "DEFS.h" 18 19ENTRY(alloca) 20 popl %edx 21 22 popl %edx /* pop return addr */ 23 popl %eax /* pop amount to allocate */ 24 movl %esp,%ecx 25 addl $3,%eax /* round up to next word, compensate for arg */ 26 andl $0xfffffffc,%eax 27 subl %eax,%esp 28 pushl 8(%ecx) /* copy possible saved registers */ 29 pushl 4(%ecx) 30 pushl 0(%ecx) 31 pushl %eax /* dummy to pop at callsite */ 32 jmp %edx /* "return" */ 33