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