1/*	$NetBSD: setjmp.S,v 1.1.1.1 2018/08/16 18:17:47 jmcneill Exp $	*/
2
3/*
4 * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
5 * Copright (c) 2017 Lemote Co.
6 * Author: Heiher <r@hev.cc>
7 *
8 * This program and the accompanying materials are licensed and made
9available
10 * under the terms and conditions of the BSD License which accompanies
11this
12 * distribution.  The full text of the license may be found at
13 * http://opensource.org/licenses/bsd-license.php.
14 *
15 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
16BASIS,
17 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
18 * IMPLIED.
19 */
20	.text
21	.p2align 3
22
23	.globl	setjmp
24	.type	setjmp, @function
25setjmp:
26	sd	$ra, 0x00($a0)
27	sd	$sp, 0x08($a0)
28	sd	$fp, 0x10($a0)
29	sd	$gp, 0x18($a0)
30
31	sd	$s0, 0x20($a0)
32	sd	$s1, 0x28($a0)
33	sd	$s2, 0x30($a0)
34	sd	$s3, 0x38($a0)
35	sd	$s4, 0x40($a0)
36	sd	$s5, 0x48($a0)
37	sd	$s6, 0x50($a0)
38	sd	$s7, 0x58($a0)
39
40#ifdef	__mips_hard_float
41	mfc0	$v0, $12
42	ext	$v0, $v0, 29, 1
43	beqz	$v0, 1f
44
45	s.d	$f24, 0x60($a0)
46	s.d	$f25, 0x68($a0)
47	s.d	$f26, 0x70($a0)
48	s.d	$f27, 0x78($a0)
49	s.d	$f28, 0x80($a0)
50	s.d	$f29, 0x88($a0)
51	s.d	$f30, 0x90($a0)
52	s.d	$f31, 0x98($a0)
53
541:
55#endif
56	move	$v0, $zero
57	jr	$ra
58
59	.globl	longjmp
60	.type	longjmp, @function
61longjmp:
62	ld	$ra, 0x00($a0)
63	ld	$sp, 0x08($a0)
64	ld	$fp, 0x10($a0)
65	ld	$gp, 0x18($a0)
66
67	ld	$s0, 0x20($a0)
68	ld	$s1, 0x28($a0)
69	ld	$s2, 0x30($a0)
70	ld	$s3, 0x38($a0)
71	ld	$s4, 0x40($a0)
72	ld	$s5, 0x48($a0)
73	ld	$s6, 0x50($a0)
74	ld	$s7, 0x58($a0)
75
76#ifdef	__mips_hard_float
77	mfc0	$v0, $12
78	ext	$v0, $v0, 29, 1
79	beqz	$v0, 1f
80
81	l.d	$f24, 0x60($a0)
82	l.d	$f25, 0x68($a0)
83	l.d	$f26, 0x70($a0)
84	l.d	$f27, 0x78($a0)
85	l.d	$f28, 0x80($a0)
86	l.d	$f29, 0x88($a0)
87	l.d	$f30, 0x90($a0)
88	l.d	$f31, 0x98($a0)
89
901:
91#endif
92	li	$v0, 1
93	movn	$v0, $a1, $a1
94	jr	$ra
95