1N/A/*
1N/A * CDDL HEADER START
1N/A *
1N/A * The contents of this file are subject to the terms of the
1N/A * Common Development and Distribution License, Version 1.0 only
1N/A * (the "License"). You may not use this file except in compliance
1N/A * with the License.
1N/A *
1N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1N/A * or http://www.opensolaris.org/os/licensing.
1N/A * See the License for the specific language governing permissions
1N/A * and limitations under the License.
1N/A *
1N/A * When distributing Covered Code, include this CDDL HEADER in each
1N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1N/A * If applicable, add the following below this CDDL HEADER, with the
1N/A * fields enclosed by brackets "[]" replaced with your own identifying
1N/A * information: Portions Copyright [yyyy] [name of copyright owner]
1N/A *
1N/A * CDDL HEADER END
1N/A */
1N/A/*
1N/A * Copyright (c) 1987 Sun Microsystems, Inc.
1N/A */
1N/A
1N/A#ident "%Z%%M% %I% %E% SMI"
1N/A
1N/A .file "alloca.s"
1N/A
1N/A#include <sys/asm_linkage.h>
1N/A
1N/A !
1N/A ! o0: # bytes of space to allocate, already rounded to 0 mod 8
1N/A ! o1: %sp-relative offset of tmp area
1N/A ! o2: %sp-relative offset of end of tmp area
1N/A !
1N/A ! we want to bump %sp by the requested size
1N/A ! then copy the tmp area to its new home
1N/A ! this is necessasy as we could theoretically
1N/A ! be in the middle of a compilicated expression.
1N/A !
1N/A ENTRY(__builtin_alloca)
1N/A mov %sp, %o3 ! save current sp
1N/A sub %sp, %o0, %sp ! bump to new value
1N/A ! copy loop: should do nothing gracefully
1N/A b 2f
1N/A subcc %o2, %o1, %o5 ! number of bytes to move
1N/A1:
1N/A ld [%o3 + %o1], %o4 ! load from old temp area
1N/A st %o4, [%sp + %o1] ! store to new temp area
1N/A add %o1, 4, %o1
1N/A2: bg 1b
1N/A subcc %o5, 4, %o5
1N/A ! now return new %sp + end-of-temp
1N/A retl
1N/A add %sp, %o2, %o0
1N/A
1N/A SET_SIZE(__builtin_alloca)
1N/A