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