]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/i386/__longjmp.S
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / i386 / __longjmp.S
1 /* longjmp for i386.
2 Copyright (C) 1995-2015 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 Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the 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 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19 #include <sysdep.h>
20 #include <jmpbuf-offsets.h>
21 #include <asm-syntax.h>
22 #include <stap-probe.h>
23
24 .text
25 ENTRY (__longjmp)
26 #ifdef PTR_DEMANGLE
27 movl 4(%esp), %eax /* User's jmp_buf in %eax. */
28
29 /* Save the return address now. */
30 movl (JB_PC*4)(%eax), %edx
31 /* Get the stack pointer. */
32 movl (JB_SP*4)(%eax), %ecx
33 PTR_DEMANGLE (%edx)
34 PTR_DEMANGLE (%ecx)
35 LIBC_PROBE (longjmp, 3, 4@%eax, -4@8(%esp), 4@%edx)
36 cfi_def_cfa(%eax, 0)
37 cfi_register(%eip, %edx)
38 cfi_register(%esp, %ecx)
39 cfi_offset(%ebx, JB_BX*4)
40 cfi_offset(%esi, JB_SI*4)
41 cfi_offset(%edi, JB_DI*4)
42 cfi_offset(%ebp, JB_BP*4)
43 /* Restore registers. */
44 movl (JB_BX*4)(%eax), %ebx
45 movl (JB_SI*4)(%eax), %esi
46 movl (JB_DI*4)(%eax), %edi
47 movl (JB_BP*4)(%eax), %ebp
48 cfi_restore(%ebx)
49 cfi_restore(%esi)
50 cfi_restore(%edi)
51 cfi_restore(%ebp)
52
53 LIBC_PROBE (longjmp_target, 3, 4@%eax, -4@8(%esp), 4@%edx)
54 movl 8(%esp), %eax /* Second argument is return value. */
55 movl %ecx, %esp
56 #else
57 movl 4(%esp), %ecx /* User's jmp_buf in %ecx. */
58 movl 8(%esp), %eax /* Second argument is return value. */
59 /* Save the return address now. */
60 movl (JB_PC*4)(%ecx), %edx
61 LIBC_PROBE (longjmp, 3, 4@%ecx, -4@%eax, 4@%edx)
62 /* Restore registers. */
63 movl (JB_BX*4)(%ecx), %ebx
64 movl (JB_SI*4)(%ecx), %esi
65 movl (JB_DI*4)(%ecx), %edi
66 movl (JB_BP*4)(%ecx), %ebp
67 movl (JB_SP*4)(%ecx), %esp
68 LIBC_PROBE (longjmp_target, 3, 4@%ecx, -4@%ecx, 4@%edx)
69 #endif
70 /* Jump to saved PC. */
71 jmp *%edx
72 END (__longjmp)