]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/sh/sh3/setjmp.S
b02b08fbf3ca6b5506272bb15d7696681599380c
[thirdparty/glibc.git] / sysdeps / sh / sh3 / setjmp.S
1 /* setjmp for SH3.
2 Copyright (C) 1999-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19 #include <sysdep.h>
20 #include <jmpbuf-offsets.h>
21
22 ENTRY (__sigsetjmp)
23 /* Save registers */
24 add #(JB_SIZE - 4 * 5), r4
25 stc.l gbr, @-r4
26 #ifdef PTR_MANGLE
27 sts pr, r2
28 PTR_MANGLE (r2, r1)
29 mov.l r2, @-r4
30 mov r15, r2
31 PTR_MANGLE2 (r2, r1)
32 mov.l r2, @-r4
33 mov r14, r2
34 PTR_MANGLE2 (r2, r1)
35 mov.l r2, @-r4
36 mov #0, r1
37 #else
38 sts.l pr, @-r4
39 mov.l r15, @-r4
40 mov.l r14, @-r4
41 #endif
42 mov.l r13, @-r4
43 mov.l r12, @-r4
44 mov.l r11, @-r4
45 mov.l r10, @-r4
46 mov.l r9, @-r4
47 mov.l r8, @-r4
48
49 #if IS_IN (rtld)
50 /* In ld.so we never save the signal mask. */
51 rts
52 mov #0, r0
53 #else
54 /* Make a tail call to __sigjmp_save; it takes the same args. */
55 # ifdef SHARED
56 mov.l 1f, r1
57 mova 1f, r0
58 bra 2f
59 add r1, r0
60 .align 2
61 1:
62 .long _GLOBAL_OFFSET_TABLE_
63 2:
64 mov.l .L1, r1
65 mov.l @(r0,r1), r1
66 jmp @r1
67 nop
68 .align 2
69 .L1:
70 .long C_SYMBOL_NAME(__sigjmp_save@GOT)
71 # else
72 mov.l .L1, r1
73 jmp @r1
74 nop
75 .align 2
76 .L1:
77 .long C_SYMBOL_NAME(__sigjmp_save)
78 # endif
79 #endif
80 END (__sigsetjmp)
81 hidden_def (__sigsetjmp)