FreeBSD/Linux Kernel Cross Reference
sys/i386/_setjmp.s
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: _setjmp.s,v $
29 * Revision 2.5 93/02/04 07:55:31 danner
30 * Convert asm comment "/" over to "/ *" "* /"
31 * [93/01/27 rvb]
32 *
33 * Revision 2.4 91/05/14 16:02:32 mrt
34 * Correcting copyright
35 *
36 * Revision 2.3 91/02/05 17:10:37 mrt
37 * Changed to new Mach copyright
38 * [91/02/01 17:30:23 mrt]
39 *
40 * Revision 2.2 90/05/03 15:21:17 dbg
41 * First checkin.
42 *
43 * Revision 1.3 89/11/30 19:52:47 kupfer
44 * Changes for Tahoe and a.out.
45 *
46 * Revision 1.2 89/11/16 21:22:02 kupfer
47 * longjmp should reset the floating point coprocessor.
48 */
49
50 /*
51 * C library -- _setjmp, _longjmp
52 *
53 * _longjmp(a,v)
54 * will generate a "return(v)" from
55 * the last call to
56 * _setjmp(a)
57 * by restoring registers from the stack,
58 * The previous signal state is NOT restored.
59 *
60 */
61
62 #include <i386/asm.h>
63
64 ENTRY(_setjmp)
65 movl 4(%esp),%ecx /* fetch buffer */
66 movl %ebx,0(%ecx)
67 movl %esi,4(%ecx)
68 movl %edi,8(%ecx)
69 movl %ebp,12(%ecx) /* save frame pointer of caller */
70 popl %edx
71 movl %esp,16(%ecx) /* save stack pointer of caller */
72 movl %edx,20(%ecx) /* save pc of caller */
73 xorl %eax,%eax
74 jmp *%edx
75
76 ENTRY(_longjmp)
77 movl 8(%esp),%eax /* return(v) */
78 movl 4(%esp),%ecx /* fetch buffer */
79 movl 0(%ecx),%ebx
80 movl 4(%ecx),%esi
81 movl 8(%ecx),%edi
82 movl 12(%ecx),%ebp
83 movl 16(%ecx),%esp
84 orl %eax,%eax
85 jnz 0f
86 incl %eax
87 0: jmp *20(%ecx) /* done, return.... */
Cache object: bafc20cc91ccd5def968e12fca419e9a
|