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