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 https://opensource.org/licenses/CDDL-1.0.
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 (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
37 * Setjmp and longjmp implement non-local gotos using state vectors
42 ENTRY(setjmp) /* save area is passed in eax */
43 movl %ebp, 0(%eax) /* save ebp */
44 movl %ebx, 4(%eax) /* save ebx */
45 movl %esi, 8(%eax) /* save esi */
46 movl %edi, 12(%eax) /* save edi */
47 movl %esp, 16(%eax) /* save esp */
48 movl (%esp), %ecx /* %eip (return address) */
49 movl %ecx, 20(%eax) /* save eip */
50 subl %eax, %eax /* return 0 */
54 ENTRY(longjmp) /* save area is passed in eax */
55 movl 0(%eax), %ebp /* restore ebp */
56 movl 4(%eax), %ebx /* restore ebx */
57 movl 8(%eax), %esi /* restore esi */
58 movl 12(%eax), %edi /* restore edi */
59 movl 16(%eax), %esp /* restore esp */
60 movl 20(%eax), %ecx /* %eip (return address) */
61 addl $4, %esp /* pop ret adr */
62 jmp *%ecx /* indirect jump */
66 .section .note.GNU-stack,"",%progbits