]> git.saurik.com Git - apple/libc.git/blame - i386/gen/getcontext.S
Libc-763.11.tar.gz
[apple/libc.git] / i386 / gen / getcontext.S
CommitLineData
eb1cde05 1/*
224c7076 2 * Copyright (c) 2007 Apple Inc. All rights reserved.
eb1cde05
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
224c7076
A
24#if defined(__i386__)
25
eb1cde05 26#include <architecture/i386/asm_help.h>
eb1cde05 27
224c7076
A
28TEXT
29LABEL(_getcontext)
30 subl $28, %esp
31 movl 32(%esp), %eax
32 movl %eax, (%esp)
33 movl %esp, 4(%esp)
34 CALL_EXTERN(_getmcontext)
35 movl %eax, %ecx
36 addl $28, %esp
37 movl %ebx, 16(%ecx)
38 movl %edi, 28(%ecx)
39 movl %esi, 32(%ecx)
40 movl %ebp, 36(%ecx)
41 movl (%esp), %eax
42 movl %eax, 52(%ecx)
43 movl %esp, %eax
44 addl $4, %eax
45 movl %eax, 40(%ecx)
46 pushf
47 popl %eax
48 movl %eax, 48(%ecx)
49 xorl %eax, %eax
50 movl %eax, 12(%ecx)
51 ret
52
53#endif /* __i386__ */