4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
30 * _stack_grow(void *addr)
32 * uintptr_t base = (uintptr_t)curthread->ul_ustack.ss_sp;
33 * size_t size = curthread->ul_ustack.ss_size;
35 * if (size > (uintptr_t)addr - base)
41 * if (size > %sp - base)
42 * %sp = base - STACK_ALIGN;
44 * *((char *)(base - 1));
46 * _lwp_kill(_lwp_self(), SIGSEGV);
55 movl
%gs
:UL_USTACK+SS_SP
, %ecx
56 movl
%gs
:UL_USTACK+SS_SIZE
, %edx
64 / If the stack size is
0, stack checking is disabled.
71 / Move the stack pointer outside the stack bounds if it isn
't already.
80 subl $STACK_ALIGN, %esp
83 / Dereference an address in the guard page.
88 / If the above load doesn't raise
a SIGSEGV then do it ourselves.
90 SYSTRAP_RVAL1
(lwp_self
)
94 SYSTRAP_RVAL1
(lwp_kill
)
98 / Try one last time to take out the process.
101 SET_SIZE
(_stack_grow
)