2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved
26 * 20-Apr-92 Bruce Martin (bmartin@next.com)
27 * Created from M68K sources.
31 * C library -- _setjmp, _longjmp
34 * will generate a "return(v)" from
37 * by restoring registers from the stack,
38 * The previous signal state is NOT restored.
42 #include <architecture/i386/asm_help.h>
65 movl 4(%esp), %ecx // jmp_buf (struct sigcontext *)
67 // now build sigcontext
68 movl %ebx, JB_EBX(%ecx)
69 movl %edi, JB_EDI(%ecx)
70 movl %esi, JB_ESI(%ecx)
71 movl %ebp, JB_EBP(%ecx)
73 // EIP is set to the frame return address value
75 movl %eax, JB_EIP(%ecx)
76 // ESP is set to the frame return address plus 4
79 movl %eax, JB_ESP(%ecx)
91 // save eflags - you can't use movl
94 movl %eax, JB_EFLAGS(%ecx)
103 fnstcw (%esp) // save FP control word
104 fninit // reset FP coprocessor
105 fldcw (%esp) // restore FP control word
108 movl 4(%esp), %ecx // jmp_buf (struct sigcontext *)
109 movl 8(%esp), %eax // return value
115 1: movl JB_EBX(%ecx), %ebx
116 movl JB_ESI(%ecx), %esi
117 movl JB_EDI(%ecx), %edi
118 movl JB_EBP(%ecx), %ebp
119 movl JB_ESP(%ecx), %esp
132 pushl JB_EFLAGS(%ecx)