SCCS-vsn: lib/libc/vax/gen/alloca.s 5.5
- * Copyright (c) 1983 The Regents of the University of California.
+ * Copyright (c) 1991 The Regents of the University of California.
- * %sccs.include.proprietary.c%
+ * %sccs.include.redist.c%
*/
#if defined(LIBC_SCCS) && !defined(lint)
*/
#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)alloca.s 5.4 (Berkeley) %G%"
+ .asciz "@(#)alloca.s 5.5 (Berkeley) %G%"
#endif /* LIBC_SCCS and not lint */
#endif /* LIBC_SCCS and not lint */
-/* like alloc, but automatic free in return */
-
#include "DEFS.h"
ENTRY(alloca, 0)
#include "DEFS.h"
ENTRY(alloca, 0)
- subl2 4(ap),sp /* crude allocation */
- movl 16(fp),r1 /* pc */
- movq 8(fp),ap /* new (old) ap and fp */
- bicl2 $3,sp /* 4-byte align */
- addl2 $7*4,sp /* reuse space of mscp */
- movl sp,r0 /* return value */
- jmp (r1) /* funny return */
+ movl 4(ap),r0 # get allocation size
+ movl 16(fp),r2 # save return address before we smash it
+ movab here,16(fp)
+ ret
+here:
+ subl2 r0,sp # create stack space
+ bicl2 $3,sp # align to longword boundary
+ movl sp,r0
+ jmp (r2)