Update copyright notices with scripts/update-copyrights
[glibc.git] / ports / sysdeps / unix / sysv / linux / mips / ____longjmp_chk.c
blob6e329eb08a58759dd62237c375c467a4de71c919
1 /* Copyright (C) 2009-2014 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/>. */
18 #include <signal.h>
19 #include <stdio.h>
20 #define __longjmp ____longjmp_chk
21 #define CHECK_SP(saved_sp, cur_sp, sp_type) \
22 do { \
23 sp_type sp_saved = (sp_type) (saved_sp); \
24 if (sp_saved < (cur_sp)) \
25 { \
26 struct __jmp_buf_internal_tag *env_save = env_arg; \
27 int val_save = val_arg; \
28 stack_t ss; \
29 int ret = __sigaltstack (NULL, &ss); \
30 if (ret == 0 \
31 && (!(ss.ss_flags & SS_ONSTACK) \
32 || ((unsigned sp_type) ((sp_type) (long) ss.ss_sp \
33 + (sp_type) ss.ss_size \
34 - sp_saved) \
35 < ss.ss_size))) \
36 __fortify_fail ("longjmp causes uninitialized stack frame"); \
37 asm volatile ("move %0, %1" : "=r" (env) : "r" (env_save)); \
38 asm volatile ("move %0, %1" : "=r" (val) : "r" (val_save)); \
39 } \
40 } while (0)
41 #include <__longjmp.c>