1 /* Copyright (C) 2001-2015 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
19 #include <jmpbuf-offsets.h>
20 #include <asm-syntax.h>
21 #include <stap-probe.h>
23 /* Jump to the position specified by ENV, causing the
24 setjmp call there to return VAL, or 1 if VAL is 0.
25 void __longjmp (__jmp_buf env, int val). */
28 /* Restore registers. */
29 mov (JB_RSP*8)(%rdi),%R8_LP
30 mov (JB_RBP*8)(%rdi),%R9_LP
31 mov (JB_PC*8)(%rdi),%RDX_LP
35 PTR_DEMANGLE (%RDX_LP)
37 /* We ignored the high bits of the %rbp value because only the low
38 bits are mangled. But we cannot presume that %rbp is being used
39 as a pointer and truncate it, so recover the high bits. */
40 movl (JB_RBP*8 + 4)(%rdi), %eax
45 LIBC_PROBE (longjmp, 3, LP_SIZE@%RDI_LP, -4@%esi, LP_SIZE@%RDX_LP)
46 /* We add unwind information for the target here. */
48 cfi_register(%rsp,%r8)
49 cfi_register(%rbp,%r9)
50 cfi_register(%rip,%rdx)
51 cfi_offset(%rbx,JB_RBX*8)
52 cfi_offset(%r12,JB_R12*8)
53 cfi_offset(%r13,JB_R13*8)
54 cfi_offset(%r14,JB_R14*8)
55 cfi_offset(%r15,JB_R15*8)
56 movq (JB_RBX*8)(%rdi),%rbx
57 movq (JB_R12*8)(%rdi),%r12
58 movq (JB_R13*8)(%rdi),%r13
59 movq (JB_R14*8)(%rdi),%r14
60 movq (JB_R15*8)(%rdi),%r15
61 /* Set return value for setjmp. */
65 LIBC_PROBE (longjmp_target, 3,
66 LP_SIZE@%RDI_LP, -4@%eax, LP_SIZE@%RDX_LP)