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]
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 / will generate
a "return(val)" from
33 / by restoring registers ip
, sp
, bp
, bx
, si
, and di from
'env'
36 / entry reg offset from
(%si
)
37 / env
[0] = %ebx
0 / register variables
40 / env
[3] = %ebp
12 / stack frame
43 / env
[6] = jmp flags
24
45 #include <sys/asm_linkage.h>
48 ANSI_PRAGMA_WEAK
(setjmp
,function
)
49 ANSI_PRAGMA_WEAK
(longjmp
,function
)
52 movl
4(%esp
),%eax
/ jmpbuf address
53 movl
%ebx
,0(%eax
) / save ebx
54 movl
%esi
,4(%eax
) / save esi
55 movl
%edi
,8(%eax
) / save edi
56 movl
%ebp
,12(%eax
) / save caller
's ebp
58 movl %gs:UL_SIGLINK, %ecx
60 test %ecx, %ecx / are we in a signal handler?
62 inc %edx / no, tell longjmp to clear ul_siglink
63 1: movl %edx, 24(%eax) / set flag word
65 popl %edx / return address
66 movl %esp,16(%eax) / save caller's esp
67 movl
%edx
,20(%eax
) / save caller
's return address
68 xorl %eax, %eax / return 0
74 movl 4(%esp),%edx / first parameter after return addr
75 movl 8(%esp),%eax / second parameter
76 movl 0(%edx),%ebx / restore ebx
77 movl 4(%edx),%esi / restore esi
78 movl 8(%edx),%edi / restore edi
79 movl 12(%edx),%ebp / restore caller's ebp
80 movl
16(%edx
),%esp
/ restore caller
's esp
83 test %ecx, %ecx / test flag word
85 xorl %ecx, %ecx / if set, clear ul_siglink
86 movl %ecx, %gs:UL_SIGLINK
88 test %eax,%eax / if val != 0
90 incl %eax / else return 1
92 jmp *20(%edx) / return to caller