]>
Commit | Line | Data |
---|---|---|
c9cf6dde | 1 | /* setjmp for x86-64. |
0ecb606c | 2 | Copyright (C) 2001, 2003, 2005, 2006 Free Software Foundation, Inc. |
c9cf6dde AJ |
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, write to the Free | |
17 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
18 | 02111-1307 USA. */ | |
19 | ||
20 | #include <sysdep.h> | |
0ecb606c | 21 | #include <jmpbuf-offsets.h> |
c9cf6dde AJ |
22 | #include <asm-syntax.h> |
23 | ||
24 | ENTRY (__sigsetjmp) | |
25 | /* Save registers. */ | |
26 | movq %rbx, (JB_RBX*8)(%rdi) | |
0ecb606c JJ |
27 | #ifdef PTR_MANGLE |
28 | movq %rbp, %rax | |
29 | PTR_MANGLE (%rax) | |
30 | movq %rax, (JB_RBP*8)(%rdi) | |
31 | #else | |
c9cf6dde | 32 | movq %rbp, (JB_RBP*8)(%rdi) |
0ecb606c | 33 | #endif |
c9cf6dde AJ |
34 | movq %r12, (JB_R12*8)(%rdi) |
35 | movq %r13, (JB_R13*8)(%rdi) | |
36 | movq %r14, (JB_R14*8)(%rdi) | |
37 | movq %r15, (JB_R15*8)(%rdi) | |
38 | leaq 8(%rsp), %rdx /* Save SP as it will be after we return. */ | |
0ecb606c JJ |
39 | #ifdef PTR_MANGLE |
40 | PTR_MANGLE (%rdx) | |
41 | #endif | |
c9cf6dde AJ |
42 | movq %rdx, (JB_RSP*8)(%rdi) |
43 | movq (%rsp), %rax /* Save PC we are returning to now. */ | |
0ecb606c JJ |
44 | #ifdef PTR_MANGLE |
45 | PTR_MANGLE (%rax) | |
46 | #endif | |
c9cf6dde AJ |
47 | movq %rax, (JB_PC*8)(%rdi) |
48 | ||
0ecb606c JJ |
49 | #if defined NOT_IN_libc && defined IS_IN_rtld |
50 | /* In ld.so we never save the signal mask. */ | |
51 | xorl %eax, %eax | |
52 | retq | |
53 | #else | |
c9cf6dde | 54 | /* Make a tail call to __sigjmp_save; it takes the same args. */ |
0ecb606c | 55 | # ifdef PIC |
c9cf6dde | 56 | jmp C_SYMBOL_NAME (BP_SYM (__sigjmp_save))@PLT |
0ecb606c | 57 | # else |
c9cf6dde | 58 | jmp BP_SYM (__sigjmp_save) |
0ecb606c | 59 | # endif |
c9cf6dde AJ |
60 | #endif |
61 | END (BP_SYM (__sigsetjmp)) | |
ea493b56 | 62 | hidden_def (__sigsetjmp) |