Update.
[glibc.git] / sysdeps / x86_64 / setjmp.S
blobe40381da31ac2fd751a7f7b0a12ffbd827fa5463
1 /* setjmp for x86-64.
2    Copyright (C) 2001 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
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.
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.
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.  */
20 #include <sysdep.h>
21 #define _ASM
22 #define _SETJMP_H
23 #include <bits/setjmp.h>
24 #include <asm-syntax.h>
26 ENTRY (__sigsetjmp)
27         /* Save registers.  */
28         movq %rbx, (JB_RBX*8)(%rdi)
29         movq %rbp, (JB_RBP*8)(%rdi)
30         movq %r12, (JB_R12*8)(%rdi)
31         movq %r13, (JB_R13*8)(%rdi)
32         movq %r14, (JB_R14*8)(%rdi)
33         movq %r15, (JB_R15*8)(%rdi)
34         leaq 8(%rsp), %rdx      /* Save SP as it will be after we return.  */
35         movq %rdx, (JB_RSP*8)(%rdi)
36         movq (%rsp), %rax       /* Save PC we are returning to now.  */
37         movq %rax, (JB_PC*8)(%rdi)
39         /* Make a tail call to __sigjmp_save; it takes the same args.  */
40 #ifdef  PIC
41         jmp C_SYMBOL_NAME (BP_SYM (__sigjmp_save))@PLT
42 #else
43         jmp BP_SYM (__sigjmp_save)
44 #endif
45 END (BP_SYM (__sigsetjmp))