1/* Copyright (C) 1991-2024 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
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.
8
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.
13
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 <https://www.gnu.org/licenses/>. */
17
18#include <sysdep.h>
19#include <pointer_guard.h>
20#include <sys/trap.h>
21
22#include <jmpbuf-offsets.h>
23
24ENTRY(_setjmp)
25 b 1f
26 set 0, %o1
27END(_setjmp)
28libc_hidden_def (_setjmp)
29
30ENTRY(setjmp)
31 set 1, %o1
32END(setjmp)
33
34ENTRY (__sigsetjmp)
351:
36 /* Save our PC, SP and FP. Save the signal mask if requested with
37 a tail-call for simplicity; it always returns zero. */
38 ta ST_FLUSH_WINDOWS
39
40#ifdef PTR_MANGLE
41 PTR_MANGLE (%g1, %o7, %g4)
42 PTR_MANGLE2 (%g2, %sp, %g4)
43 PTR_MANGLE2 (%g3, %fp, %g4)
44 st %g1, [%o0 + (JB_PC * 4)]
45 st %g2, [%o0 + (JB_SP * 4)]
46 st %g3, [%o0 + (JB_FP * 4)]
47#else
48 st %o7, [%o0 + (JB_PC * 4)]
49 st %sp, [%o0 + (JB_SP * 4)]
50 st %fp, [%o0 + (JB_FP * 4)]
51#endif
52
53 mov %o7, %g1
54 call __sigjmp_save
55 mov %g1, %o7
56END(__sigsetjmp)
57hidden_def (__sigsetjmp)
58
59weak_extern(_setjmp)
60weak_extern(setjmp)
61

source code of glibc/sysdeps/sparc/sparc32/setjmp.S