1/* longjmp for SH.
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#define _SETJMP_H
22#define _ASM
23#include <bits/setjmp.h>
24
25/* __longjmp(jmpbuf, val) */
26
27ENTRY (__longjmp)
28 mov.l @r4+, r8
29 mov.l @r4+, r9
30 mov.l @r4+, r10
31 mov.l @r4+, r11
32 mov.l @r4+, r12
33 mov r5, r0 /* get the return value in place */
34 tst r0, r0
35 bf.s 1f
36 mov.l @r4+, r13
37 mov #1,r0 /* can't let setjmp() return zero! */
381:
39#ifdef PTR_DEMANGLE
40 mov.l @r4+, r2
41 PTR_DEMANGLE (r2, r1)
42 mov r2, r14
43 mov.l @r4+, r2
44 PTR_DEMANGLE2 (r2, r1)
45# ifdef CHECK_SP
46 CHECK_SP (r2)
47# endif
48 mov r2, r15
49 mov.l @r4+, r2
50 PTR_DEMANGLE2 (r2, r1)
51 lds r2, pr
52 mov #0, r1
53#else
54 mov.l @r4+, r14
55# ifdef CHECK_SP
56 mov.l @r4, r2
57 CHECK_SP (r2)
58# endif
59 mov.l @r4+, r15
60 lds.l @r4+, pr
61#endif
62#ifdef __SH_FPU_ANY__
63 ldc.l @r4+, gbr
64 lds.l @r4+, fpscr
65 fmov.s @r4+, fr12
66 fmov.s @r4+, fr13
67 fmov.s @r4+, fr14
68 rts
69 fmov.s @r4+, fr15
70#else
71 rts
72 ldc.l @r4+, gbr
73#endif /* !__SH_FPU_ANY__ */
74END (__longjmp)
75

source code of glibc/sysdeps/sh/sh4/__longjmp.S