12357939bSOlivier Houchard/* $NetBSD: alloca.S,v 1.3 2003/04/05 23:08:51 bjh21 Exp $ */ 22357939bSOlivier Houchard 32357939bSOlivier Houchard/* 42357939bSOlivier Houchard * Copyright (c) 1995 Mark Brinicombe 52357939bSOlivier Houchard * All rights reserved. 62357939bSOlivier Houchard * 72357939bSOlivier Houchard * Redistribution and use in source and binary forms, with or without 82357939bSOlivier Houchard * modification, are permitted provided that the following conditions 92357939bSOlivier Houchard * are met: 102357939bSOlivier Houchard * 1. Redistributions of source code must retain the above copyright 112357939bSOlivier Houchard * notice, this list of conditions and the following disclaimer. 122357939bSOlivier Houchard * 2. Redistributions in binary form must reproduce the above copyright 132357939bSOlivier Houchard * notice, this list of conditions and the following disclaimer in the 142357939bSOlivier Houchard * documentation and/or other materials provided with the distribution. 152357939bSOlivier Houchard * 3. All advertising materials mentioning features or use of this software 162357939bSOlivier Houchard * must display the following acknowledgement: 172357939bSOlivier Houchard * This product includes software developed by Mark Brinicombe 182357939bSOlivier Houchard * 4. Neither the name of the University nor the names of its contributors 192357939bSOlivier Houchard * may be used to endorse or promote products derived from this software 202357939bSOlivier Houchard * without specific prior written permission. 212357939bSOlivier Houchard * 222357939bSOlivier Houchard * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 232357939bSOlivier Houchard * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 242357939bSOlivier Houchard * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 252357939bSOlivier Houchard * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 262357939bSOlivier Houchard * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 272357939bSOlivier Houchard * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 282357939bSOlivier Houchard * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 292357939bSOlivier Houchard * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 302357939bSOlivier Houchard * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 312357939bSOlivier Houchard * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 322357939bSOlivier Houchard * SUCH DAMAGE. 332357939bSOlivier Houchard */ 342357939bSOlivier Houchard 352357939bSOlivier Houchard/* like alloc, but automatic automatic free in return */ 362357939bSOlivier Houchard 372357939bSOlivier Houchard#include <machine/asm.h> 382357939bSOlivier HouchardENTRY(alloca) 392357939bSOlivier Houchard add r0, r0, #0x00000007 /* round up to next 8 byte alignment */ 402357939bSOlivier Houchard bic r0, r0, #0x00000007 412357939bSOlivier Houchard sub sp, sp, r0 /* Adjust the stack pointer */ 422357939bSOlivier Houchard mov r0, sp /* r0 = base of new space */ 4331489a9aSOlivier Houchard RET 44f2e71517SIan LeporeEND(alloca) 45*96cdb0abSKonstantin Belousov 46*96cdb0abSKonstantin Belousov .section .note.GNU-stack,"",%progbits 47