Blame sysdeps/arm/setjmp.S

Packit 6c4009
/* setjmp for ARM.
Packit 6c4009
   Copyright (C) 1997-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 <stap-probe.h>
Packit 6c4009
#include <bits/setjmp.h>
Packit 6c4009
#include <rtld-global-offsets.h>
Packit 6c4009
#include <arm-features.h>
Packit 6c4009
Packit 6c4009
ENTRY (__sigsetjmp)
Packit 6c4009
#ifdef PTR_MANGLE
Packit 6c4009
	PTR_MANGLE_LOAD (a3, ip)
Packit 6c4009
#endif
Packit 6c4009
	mov	ip, r0
Packit 6c4009
Packit 6c4009
	/* setjmp probe expects sigsetjmp first argument (4@r0), second
Packit 6c4009
	   argument (-4@r1), and target address (4@r14), respectively.  */
Packit 6c4009
	LIBC_PROBE (setjmp, 3, 4@r0, -4@r1, 4@r14)
Packit 6c4009
Packit 6c4009
	/* Save sp and lr */
Packit 6c4009
#ifdef PTR_MANGLE
Packit 6c4009
	mov	a4, sp
Packit 6c4009
	PTR_MANGLE2 (a4, a4, a3)
Packit 6c4009
	str	a4, [ip], #4
Packit 6c4009
	PTR_MANGLE2 (a4, lr, a3)
Packit 6c4009
	str	a4, [ip], #4
Packit 6c4009
#else
Packit 6c4009
	str	sp, [ip], #4
Packit 6c4009
	str	lr, [ip], #4
Packit 6c4009
#endif
Packit 6c4009
	/* Save registers */
Packit 6c4009
	stmia	ip!, JMP_BUF_REGLIST
Packit 6c4009
Packit 6c4009
#if !defined ARM_ASSUME_NO_IWMMXT || defined __SOFTFP__
Packit 6c4009
# define NEED_HWCAP 1
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef NEED_HWCAP
Packit 6c4009
	/* Check if we have a VFP unit.  */
Packit 6c4009
# if IS_IN (rtld)
Packit 6c4009
	LDST_PCREL (ldr, a3, a4, \
Packit 6c4009
		    C_SYMBOL_NAME(_rtld_local_ro) \
Packit 6c4009
		    + RTLD_GLOBAL_RO_DL_HWCAP_OFFSET)
Packit 6c4009
# else
Packit 6c4009
#  ifdef SHARED
Packit 6c4009
	LDR_GLOBAL (a3, a4, C_SYMBOL_NAME(_rtld_global_ro), \
Packit 6c4009
		    RTLD_GLOBAL_RO_DL_HWCAP_OFFSET)
Packit 6c4009
#  else
Packit 6c4009
	LDR_GLOBAL (a3, a4, C_SYMBOL_NAME(_dl_hwcap), 0)
Packit 6c4009
#  endif
Packit 6c4009
# endif
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef __SOFTFP__
Packit 6c4009
	tst	a3, #HWCAP_ARM_VFP
Packit 6c4009
	beq	.Lno_vfp
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
	/* Store the VFP registers.
Packit 6c4009
	   Don't use VFP instructions directly because this code
Packit 6c4009
	   is used in non-VFP multilibs.  */
Packit 6c4009
	/* Following instruction is vstmia ip!, {d8-d15}.  */
Packit 6c4009
	stc	p11, cr8, [ip], #64
Packit 6c4009
.Lno_vfp:
Packit 6c4009
Packit 6c4009
#ifndef ARM_ASSUME_NO_IWMMXT
Packit 6c4009
	tst	a3, #HWCAP_ARM_IWMMXT
Packit 6c4009
	beq	.Lno_iwmmxt
Packit 6c4009
Packit 6c4009
	/* Save the call-preserved iWMMXt registers.  */
Packit 6c4009
	/* Following instructions are wstrd wr10, [ip], #8 (etc.)  */
Packit 6c4009
	stcl	p1, cr10, [r12], #8
Packit 6c4009
	stcl	p1, cr11, [r12], #8
Packit 6c4009
	stcl	p1, cr12, [r12], #8
Packit 6c4009
	stcl	p1, cr13, [r12], #8
Packit 6c4009
	stcl	p1, cr14, [r12], #8
Packit 6c4009
	stcl	p1, cr15, [r12], #8
Packit 6c4009
.Lno_iwmmxt:
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
	/* Make a tail call to __sigjmp_save; it takes the same args.  */
Packit 6c4009
	B	PLTJMP(C_SYMBOL_NAME(__sigjmp_save))
Packit 6c4009
Packit 6c4009
END (__sigsetjmp)
Packit 6c4009
Packit 6c4009
hidden_def (__sigsetjmp)