1 /* Copyright (C) 1992, 1994, 1997, 2006, 2010 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>
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 /* Jump to the position specified by ENV, causing the
31 setjmp call there to return VAL, or 1 if VAL is 0.
32 void __longjmp (__jmp_buf env, int val). */
35 .globl ____longjmp_chk
36 .type ____longjmp_chk, @function
37 .usepv ____longjmp_chk, std
73 cfi_offset(s0, JB_S0*8)
74 cfi_offset(s1, JB_S1*8)
75 cfi_offset(s2, JB_S2*8)
76 cfi_offset(s3, JB_S3*8)
77 cfi_offset(s4, JB_S4*8)
78 cfi_offset(s5, JB_S5*8)
79 cfi_offset(s3, JB_S3*8)
80 cfi_offset($f2, JB_F2*8)
81 cfi_offset($f3, JB_F3*8)
82 cfi_offset($f4, JB_F4*8)
83 cfi_offset($f5, JB_F5*8)
84 cfi_offset($f6, JB_F6*8)
85 cfi_offset($f7, JB_F7*8)
86 cfi_offset($f8, JB_F8*8)
87 cfi_offset($f9, JB_F9*8)
108 lda v0, __NR_sigaltstack
112 cfi_adjust_cfa_offset(32)
114 ldq t0, 0(sp) /* ss_sp */
115 ldl t1, 8(sp) /* ss_flags */
116 ldq t2, 16(sp) /* ss_size */
118 cfi_adjust_cfa_offset(-32)
120 /* Without working sigaltstack we cannot perform the test. */
123 addq t0, t2, t0 /* t0 = ss_sp + ss_size */
124 subq t0, s3, t0 /* t0 = (ss_sp + ss_size) - new_sp */
125 cmpule t2, t0, t0 /* t0 = (t0 >= ss_size) */
126 and t0, t1, t0 /* t0 = (t0 >= ss_size) & (ss_flags & SS_ONSTACK) */
129 ldah a0, longjmp_msg(gp) !gprelhigh
130 lda a0, longjmp_msg(a0) !gprellow
132 jsr ra, HIDDEN_JUMPTARGET(__fortify_fail)
134 bsr ra, HIDDEN_JUMPTARGET(__fortify_fail) !samegp
139 .size ____longjmp_chk, .-____longjmp_chk