]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/i386/__longjmp.S
* sysdeps/i386/bp-asm.h: New file.
[thirdparty/glibc.git] / sysdeps / i386 / __longjmp.S
1 /* longjmp for i386.
2 Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
19
20 #include <sysdep.h>
21 #define _ASM
22 #define _SETJMP_H
23 #include <bits/setjmp.h>
24 #include <bp-asm.h>
25
26 #define PARMS LINKAGE /* no space for saved regs */
27 #define JBUF PARMS
28 #define VAL JBUF+PTR_SIZE
29
30 ENTRY (__longjmp)
31 ENTER
32
33 movl JBUF(%esp), %ecx /* User's jmp_buf in %ecx. */
34 LEAVE
35
36 movl VAL(%esp), %eax /* Second argument is return value. */
37 /* Save the return address now. */
38 movl (JB_PC*4)(%ecx), %edx
39 /* Restore registers. */
40 movl (JB_BX*4)(%ecx), %ebx
41 movl (JB_SI*4)(%ecx), %esi
42 movl (JB_DI*4)(%ecx), %edi
43 movl (JB_BP*4)(%ecx), %ebp
44 movl (JB_SP*4)(%ecx), %esp
45 /* Jump to saved PC. */
46 jmp *%edx
47 END (__longjmp)