2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 * Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved
29 * 20-Apr-92 Bruce Martin (bmartin@next.com)
30 * Created from M68K sources.
34 * C library -- _setjmp, _longjmp
37 * will generate a "return(v)" from
40 * by restoring registers from the stack,
41 * The previous signal state is NOT restored.
45 #include <architecture/i386/asm_help.h>
68 movl 4(%esp), %ecx // jmp_buf (struct sigcontext *)
70 // now build sigcontext
71 movl %ebx, JB_EBX(%ecx)
72 movl %edi, JB_EDI(%ecx)
73 movl %esi, JB_ESI(%ecx)
74 movl %ebp, JB_EBP(%ecx)
76 // EIP is set to the frame return address value
78 movl %eax, JB_EIP(%ecx)
79 // ESP is set to the frame return address plus 4
82 movl %eax, JB_ESP(%ecx)
94 // save eflags - you can't use movl
97 movl %eax, JB_EFLAGS(%ecx)
106 fnstcw (%esp) // save FP control word
107 fninit // reset FP coprocessor
108 fldcw (%esp) // restore FP control word
111 movl 4(%esp), %ecx // jmp_buf (struct sigcontext *)
112 movl 8(%esp), %eax // return value
118 1: movl JB_EBX(%ecx), %ebx
119 movl JB_ESI(%ecx), %esi
120 movl JB_EDI(%ecx), %edi
121 movl JB_EBP(%ecx), %ebp
122 movl JB_ESP(%ecx), %esp
135 pushl JB_EFLAGS(%ecx)