1 /* Copyright (C) 2001,2004,2005,2006,2009,2010,2011 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, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #include <jmpbuf-offsets.h>
21 #include <asm-syntax.h>
23 .section .rodata.str1.1,"aMS",@progbits,1
24 .type longjmp_msg,@object
26 .string "longjmp causes uninitialized stack frame"
27 .size longjmp_msg, .-longjmp_msg
30 //#define __longjmp ____longjmp_chk
33 # define CALL_FAIL subq $8, %rsp; \
35 cfi_def_cfa_offset(16); \
36 leaq longjmp_msg(%rip), %rdi; \
37 call __GI___fortify_fail; \
41 # define CALL_FAIL subq $8, %rsp; \
43 cfi_def_cfa_offset(16); \
44 movq $longjmp_msg, %rdi; \
45 call __fortify_fail; \
50 /* Jump to the position specified by ENV, causing the
51 setjmp call there to return VAL, or 1 if VAL is 0.
52 void __longjmp (__jmp_buf env, int val). */
54 ENTRY(____longjmp_chk)
55 /* Restore registers. */
56 movq (JB_RSP*8)(%rdi), %r8
57 movq (JB_RBP*8)(%rdi), %r9
58 movq (JB_PC*8)(%rdi), %rdx
68 /* Save function parameters. */
70 cfi_register (%rdi, %r10)
72 cfi_register (%rsi, %rbx)
76 movl $__NR_sigaltstack, %eax
78 /* Without working sigaltstack we cannot perform the test. */
92 .Lok2: movq %r10, %rdi
97 .Lok: /* We add unwind information for the target here. */
99 cfi_register(%rsp,%r8)
100 cfi_register(%rbp,%r9)
101 cfi_register(%rip,%rdx)
102 cfi_offset(%rbx,JB_RBX*8)
103 cfi_offset(%r12,JB_R12*8)
104 cfi_offset(%r13,JB_R13*8)
105 cfi_offset(%r14,JB_R14*8)
106 cfi_offset(%r15,JB_R15*8)
107 movq (JB_RBX*8)(%rdi), %rbx
108 movq (JB_R12*8)(%rdi), %r12
109 movq (JB_R13*8)(%rdi), %r13
110 movq (JB_R14*8)(%rdi), %r14
111 movq (JB_R15*8)(%rdi), %r15
112 /* Set return value for setjmp. */
117 END (____longjmp_chk)