Blame sysdeps/nios2/setjmp.S

Packit 6c4009
/* setjmp for Nios II.
Packit 6c4009
   Copyright (C) 1991-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library.  If not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#include <sysdep.h>
Packit 6c4009
#include <jmpbuf-offsets.h>
Packit 6c4009
Packit 6c4009
	.text
Packit 6c4009
ENTRY(setjmp)
Packit 6c4009
	movi	r5, 1
Packit 6c4009
	br	__sigsetjmp
Packit 6c4009
END(setjmp)
Packit 6c4009
Packit 6c4009
ENTRY(_setjmp)
Packit 6c4009
	mov	r5, zero
Packit 6c4009
	br	__sigsetjmp
Packit 6c4009
END(_setjmp)
Packit 6c4009
libc_hidden_def (_setjmp)
Packit 6c4009
Packit 6c4009
/* Save the current program position in ENV and return 0.  */
Packit 6c4009
ENTRY(__sigsetjmp)
Packit 6c4009
#ifdef	PTR_MANGLE
Packit 6c4009
	PTR_MANGLE_GUARD (r9)
Packit 6c4009
#endif
Packit 6c4009
	stw	r16, (JB_R16*4)(r4)
Packit 6c4009
	stw	r17, (JB_R17*4)(r4)
Packit 6c4009
	stw	r18, (JB_R18*4)(r4)
Packit 6c4009
	stw	r19, (JB_R19*4)(r4)
Packit 6c4009
	stw	r20, (JB_R20*4)(r4)
Packit 6c4009
	stw	r21, (JB_R21*4)(r4)
Packit 6c4009
	stw	r22, (JB_R22*4)(r4)
Packit 6c4009
	stw	fp,  (JB_FP*4)(r4)
Packit 6c4009
#ifdef	PTR_MANGLE
Packit 6c4009
	PTR_MANGLE (r6, ra, r9)
Packit 6c4009
	PTR_MANGLE (r7, sp, r9)
Packit 6c4009
	stw	r6,  (JB_RA*4)(r4)
Packit 6c4009
	stw	r7,  (JB_SP*4)(r4)
Packit 6c4009
#else
Packit 6c4009
	stw	ra,  (JB_RA*4)(r4)
Packit 6c4009
	stw	sp,  (JB_SP*4)(r4)
Packit 6c4009
#endif
Packit 6c4009
#if IS_IN (rtld)
Packit 6c4009
	/* In ld.so we never save the signal mask.  */
Packit 6c4009
	mov r2, zero
Packit 6c4009
	ret
Packit 6c4009
#else
Packit 6c4009
	/* Save the signal mask if requested.  */
Packit 6c4009
#if defined(__PIC__) || defined(PIC)
Packit 6c4009
        nextpc r2
Packit 6c4009
1:	movhi r3, %hiadj(__sigjmp_save - 1b)
Packit 6c4009
	addi r3, r3, %lo(__sigjmp_save - 1b)
Packit 6c4009
	add r2, r2, r3
Packit 6c4009
	jmp r2
Packit 6c4009
#else
Packit 6c4009
	jmpi __sigjmp_save
Packit 6c4009
#endif
Packit 6c4009
#endif
Packit 6c4009
END (__sigsetjmp)
Packit 6c4009
libc_hidden_def (__sigsetjmp)