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.
31 * will generate a "return(val)" from
34 * by restoring registers rip rsp rbp rbx r12 r13 r14 r15 from 'env'
40 * env[0] = %rbx 0 register variables
45 * env[5] = %rbp 40 stack frame
50 #include <sys/asm_linkage.h>
53 ANSI_PRAGMA_WEAK
(setjmp
,function
)
54 ANSI_PRAGMA_WEAK
(longjmp
,function
)
63 popq
%rdx
/* return address */
67 movq
%fs:UL_SIGLINK
, %rax
69 testq
%rax
, %rax
/* are we in a signal handler? */
71 incq
%rcx
/* no, tell longjmp to clear ul_siglink */
72 1: orq
%rcx
, 48(%rdi
) /* low-order 1-bit flag in the saved %rsp */
74 xorl
%eax
, %eax
/* return 0 */
86 movq
48(%rdi
), %rax
/* test low-order bit in the saved %rsp */
89 xorq
%rcx
, %rcx
/* if set, clear ul_siglink */
90 movq
%rcx
, %fs:UL_SIGLINK
91 subq $
1, %rax
/* clear the flag bit */
95 test
%eax
, %eax
/* if val != 0 */
96 jnz
1f
/* return val */
97 incl
%eax
/* else return 1 */
99 movq
56(%rdi
), %rdx
/* return to caller of setjmp */