xref: /DragonStub/lib/mips64el/setjmp.S (revision 803b49c40bb0b720b90d9c31d372911f1b946aa7)
13f234f5bSNigel Croxon/*
23f234f5bSNigel Croxon * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
33f234f5bSNigel Croxon * Copright (c) 2017 Lemote Co.
43f234f5bSNigel Croxon * Author: Heiher <r@hev.cc>
53f234f5bSNigel Croxon *
63f234f5bSNigel Croxon * This program and the accompanying materials are licensed and made
73f234f5bSNigel Croxonavailable
83f234f5bSNigel Croxon * under the terms and conditions of the BSD License which accompanies
93f234f5bSNigel Croxonthis
103f234f5bSNigel Croxon * distribution.  The full text of the license may be found at
113f234f5bSNigel Croxon * http://opensource.org/licenses/bsd-license.php.
123f234f5bSNigel Croxon *
133f234f5bSNigel Croxon * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
143f234f5bSNigel CroxonBASIS,
153f234f5bSNigel Croxon * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
163f234f5bSNigel Croxon * IMPLIED.
173f234f5bSNigel Croxon */
183f234f5bSNigel Croxon	.text
193f234f5bSNigel Croxon	.p2align 3
203f234f5bSNigel Croxon
213f234f5bSNigel Croxon	.globl	setjmp
223f234f5bSNigel Croxon	.type	setjmp, @function
233f234f5bSNigel Croxonsetjmp:
243f234f5bSNigel Croxon	sd	$ra, 0x00($a0)
253f234f5bSNigel Croxon	sd	$sp, 0x08($a0)
263f234f5bSNigel Croxon	sd	$fp, 0x10($a0)
273f234f5bSNigel Croxon	sd	$gp, 0x18($a0)
283f234f5bSNigel Croxon
293f234f5bSNigel Croxon	sd	$s0, 0x20($a0)
303f234f5bSNigel Croxon	sd	$s1, 0x28($a0)
313f234f5bSNigel Croxon	sd	$s2, 0x30($a0)
323f234f5bSNigel Croxon	sd	$s3, 0x38($a0)
333f234f5bSNigel Croxon	sd	$s4, 0x40($a0)
343f234f5bSNigel Croxon	sd	$s5, 0x48($a0)
353f234f5bSNigel Croxon	sd	$s6, 0x50($a0)
363f234f5bSNigel Croxon	sd	$s7, 0x58($a0)
373f234f5bSNigel Croxon
383f234f5bSNigel Croxon#ifdef	__mips_hard_float
393f234f5bSNigel Croxon	mfc0	$v0, $12
403f234f5bSNigel Croxon	ext	$v0, $v0, 29, 1
413f234f5bSNigel Croxon	beqz	$v0, 1f
423f234f5bSNigel Croxon
433f234f5bSNigel Croxon	s.d	$f24, 0x60($a0)
443f234f5bSNigel Croxon	s.d	$f25, 0x68($a0)
453f234f5bSNigel Croxon	s.d	$f26, 0x70($a0)
463f234f5bSNigel Croxon	s.d	$f27, 0x78($a0)
473f234f5bSNigel Croxon	s.d	$f28, 0x80($a0)
483f234f5bSNigel Croxon	s.d	$f29, 0x88($a0)
493f234f5bSNigel Croxon	s.d	$f30, 0x90($a0)
503f234f5bSNigel Croxon	s.d	$f31, 0x98($a0)
513f234f5bSNigel Croxon
523f234f5bSNigel Croxon1:
533f234f5bSNigel Croxon#endif
543f234f5bSNigel Croxon	move	$v0, $zero
553f234f5bSNigel Croxon	jr	$ra
563f234f5bSNigel Croxon
573f234f5bSNigel Croxon	.globl	longjmp
583f234f5bSNigel Croxon	.type	longjmp, @function
593f234f5bSNigel Croxonlongjmp:
603f234f5bSNigel Croxon	ld	$ra, 0x00($a0)
613f234f5bSNigel Croxon	ld	$sp, 0x08($a0)
623f234f5bSNigel Croxon	ld	$fp, 0x10($a0)
633f234f5bSNigel Croxon	ld	$gp, 0x18($a0)
643f234f5bSNigel Croxon
653f234f5bSNigel Croxon	ld	$s0, 0x20($a0)
663f234f5bSNigel Croxon	ld	$s1, 0x28($a0)
673f234f5bSNigel Croxon	ld	$s2, 0x30($a0)
683f234f5bSNigel Croxon	ld	$s3, 0x38($a0)
693f234f5bSNigel Croxon	ld	$s4, 0x40($a0)
703f234f5bSNigel Croxon	ld	$s5, 0x48($a0)
713f234f5bSNigel Croxon	ld	$s6, 0x50($a0)
723f234f5bSNigel Croxon	ld	$s7, 0x58($a0)
733f234f5bSNigel Croxon
743f234f5bSNigel Croxon#ifdef	__mips_hard_float
753f234f5bSNigel Croxon	mfc0	$v0, $12
763f234f5bSNigel Croxon	ext	$v0, $v0, 29, 1
773f234f5bSNigel Croxon	beqz	$v0, 1f
783f234f5bSNigel Croxon
793f234f5bSNigel Croxon	l.d	$f24, 0x60($a0)
803f234f5bSNigel Croxon	l.d	$f25, 0x68($a0)
813f234f5bSNigel Croxon	l.d	$f26, 0x70($a0)
823f234f5bSNigel Croxon	l.d	$f27, 0x78($a0)
833f234f5bSNigel Croxon	l.d	$f28, 0x80($a0)
843f234f5bSNigel Croxon	l.d	$f29, 0x88($a0)
853f234f5bSNigel Croxon	l.d	$f30, 0x90($a0)
863f234f5bSNigel Croxon	l.d	$f31, 0x98($a0)
873f234f5bSNigel Croxon
883f234f5bSNigel Croxon1:
893f234f5bSNigel Croxon#endif
903f234f5bSNigel Croxon	li	$v0, 1
913f234f5bSNigel Croxon	movn	$v0, $a1, $a1
923f234f5bSNigel Croxon	jr	$ra
93*803b49c4SSergei Trofimovich
94*803b49c4SSergei Trofimovich#if defined(__ELF__) && defined(__linux__)
95*803b49c4SSergei Trofimovich	.section .note.GNU-stack,"",%progbits
96*803b49c4SSergei Trofimovich#endif
97