1: /*
   2:  * Copyright (c) 1987 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #ifdef LIBC_SCCS
   8:         <@(#)alloca.s	1.1 (Berkeley) 1/21/87\0>
   9:         .even
  10: #endif LIBC_SCCS
  11: 
  12: /* like alloc, but automatic free in return */
  13: 
  14: #include "DEFS.h"
  15: 
  16: /*
  17:  * We simply copy the size an return address down round(size, 2) down the
  18:  * stack and return.  NOTE: if alloca is called in the middle of building an
  19:  * argument list for a function call, the previously built arguments will
  20:  * *not* be copied down below the new space, causing all sorts of nastiness.
  21:  */
  22: ENTRY(alloca)
  23:         mov     (sp)+,r0        / snatch return address
  24:         mov     (sp)+,r1        /   and size
  25:         sub     r1,sp           / subtract size from stack
  26:         bic     $1,sp           /   ensuring word alignment ...
  27:         mov     r1,-(sp)        / put size and return address back onto stack
  28:         mov     r0,-(sp)
  29:         mov     sp,r0           / compute address of new area and return
  30:         cmp     (r0)+,(r0)+
  31:         rts     pc

Defined functions

_alloca defined in line 22; used 3 times
Last modified: 1987-01-25
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1298
Valid CSS Valid XHTML 1.0 Strict