1 /* Copyright (C) 2009-2013 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>
21 #define ENV(base,reg) [%base + (reg * 4)]
22 #define ST_FLUSH_WINDOWS 3
24 .section .rodata.str1.1,"aMS",@progbits,1
25 .type longjmp_msg,@object
27 .string "longjmp causes uninitialized stack frame"
28 .size longjmp_msg, .-longjmp_msg
31 ENTRY (____longjmp_chk)
34 PTR_DEMANGLE (%g5, %g5, %g4)
43 cfi_def_cfa_register(%fp)
45 cfi_register(%o7, %i7)
49 LOADSYSCALL(sigaltstack)
52 ld [%sp + 64 + 4], %o2
55 ld [%sp + 64 + 0], %o0
57 ld [%sp + 64 + 8], %o1
66 sethi %hi(longjmp_msg), %o0
67 or %o0, %lo(longjmp_msg), %o0
70 sethi %gdop_hix22(longjmp_msg), %o0
71 xor %o0, %gdop_lox10(longjmp_msg), %o0
72 ld [%l7 + %o0], %o0, %gdop(longjmp_msg)
74 call HIDDEN_JUMPTARGET(__fortify_fail)
82 ld ENV(o0,JB_FP), %g3 /* Cache target FP in register %g3. */
84 PTR_DEMANGLE2 (%g3, %g3, %g4)
87 mov %o0, %g1 /* ENV in %g1 */
88 orcc %o1, %g0, %g2 /* VAL in %g2 */
89 be,a 0f /* Branch if zero; else skip delay slot. */
90 mov 1, %g2 /* Delay slot only hit if zero: VAL = 1. */
95 * Do a "flush register windows trap". The trap handler in the
96 * kernel writes all the register windows to their stack slots, and
97 * marks them all as invalid (needing to be sucked up from the
98 * stack when used). This ensures that all information needed to
99 * unwind to these callers is in memory, not in the register
104 ld ENV(g1,JB_PC), %g1 /* Set return PC. */
105 PTR_DEMANGLE2 (%i7, %g1, %g4)
107 ld ENV(g1,JB_PC), %i7 /* Set return PC. */
111 restore %g2, 0, %o0 /* Restore values from above register frame. */