1 | /* setjmp for SH4. |
2 | Copyright (C) 1999-2024 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 <pointer_guard.h> |
21 | #include <jmpbuf-offsets.h> |
22 | |
23 | ENTRY (__sigsetjmp) |
24 | /* Save registers */ |
25 | #ifdef __SH_FPU_ANY__ |
26 | add #JB_SIZE, r4 |
27 | fmov.s fr15, @-r4 |
28 | fmov.s fr14, @-r4 |
29 | fmov.s fr13, @-r4 |
30 | fmov.s fr12, @-r4 |
31 | sts.l fpscr, @-r4 |
32 | #else |
33 | add #(JB_SIZE - 4 * 5), r4 |
34 | #endif /* __SH_FPU_ANY__ */ |
35 | stc.l gbr, @-r4 |
36 | #ifdef PTR_MANGLE |
37 | sts pr, r2 |
38 | PTR_MANGLE (r2, r1) |
39 | mov.l r2, @-r4 |
40 | mov r15, r2 |
41 | PTR_MANGLE2 (r2, r1) |
42 | mov.l r2, @-r4 |
43 | mov r14, r2 |
44 | PTR_MANGLE2 (r2, r1) |
45 | mov.l r2, @-r4 |
46 | mov #0, r1 |
47 | #else |
48 | sts.l pr, @-r4 |
49 | mov.l r15, @-r4 |
50 | mov.l r14, @-r4 |
51 | #endif |
52 | mov.l r13, @-r4 |
53 | mov.l r12, @-r4 |
54 | mov.l r11, @-r4 |
55 | mov.l r10, @-r4 |
56 | mov.l r9, @-r4 |
57 | mov.l r8, @-r4 |
58 | |
59 | #if IS_IN (rtld) |
60 | /* In ld.so we never save the signal mask. */ |
61 | rts |
62 | mov #0, r0 |
63 | #else |
64 | /* Make a tail call to __sigjmp_save; it takes the same args. */ |
65 | # ifdef SHARED |
66 | mov.l 1f, r1 |
67 | mova 1f, r0 |
68 | bra 2f |
69 | add r1, r0 |
70 | .align 2 |
71 | 1: |
72 | .long _GLOBAL_OFFSET_TABLE_ |
73 | 2: |
74 | mov.l .L1, r1 |
75 | mov.l @(r0,r1), r1 |
76 | jmp @r1 |
77 | nop |
78 | .align 2 |
79 | .L1: |
80 | .long C_SYMBOL_NAME(__sigjmp_save@GOT) |
81 | # else |
82 | mov.l .L1, r1 |
83 | jmp @r1 |
84 | nop |
85 | .align 2 |
86 | .L1: |
87 | .long C_SYMBOL_NAME(__sigjmp_save) |
88 | # endif |
89 | #endif |
90 | END (__sigsetjmp) |
91 | hidden_def (__sigsetjmp) |
92 | |