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

source code of glibc/sysdeps/sh/sh3/setjmp.S