Start to remove _libc_arm_fpu_present checks. We don't support the VFP on

ARMv4 or ARMv5, and only support it when it's present on ARMv6 and later.
As such always store the VFP register in setjmp and restore them in
longjmp when building for armv6.

Reviewed by:	mmel
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D11393
This commit is contained in:
Andrew Turner 2017-06-29 14:00:05 +00:00
parent 80bfc295ef
commit 3ab06e30cb
2 changed files with 10 additions and 50 deletions

View File

@ -61,25 +61,12 @@ __FBSDID("$FreeBSD$");
ENTRY(_setjmp)
ldr r1, .L_setjmp_magic
#if !defined(_STANDALONE)
ldr r2, .Lfpu_present
#ifdef PIC
GOT_INIT(r3, .L_setjmp_got, .L_setjmp_gotinit)
ldr r2, [r2, r3]
#else
ldr r2, [r2]
#endif
teq r2, #0 /* do we have a FPU? */
beq 1f /* no, don't save VFP registers */
orr r1, r1, #(_JB_MAGIC__SETJMP ^ _JB_MAGIC__SETJMP_VFP)
/* change magic to VFP magic */
#if !defined(_STANDALONE) && __ARM_ARCH >= 6
add r2, r0, #(_JB_REG_D8 * 4)
vstmia r2, {d8-d15}
vmrs r2, fpscr
str r2, [r0, #(_JB_REG_FPSCR * 4)]
1:
#endif /* !_STANDALONE */
#endif /* !_STANDALONE && __ARM_ARCH >= 6 */
str r1, [r0]
@ -99,30 +86,20 @@ END(_setjmp)
.L_setjmp_magic:
.word _JB_MAGIC__SETJMP
#if !defined(_STANDALONE)
GOT_INITSYM(.L_setjmp_got, .L_setjmp_gotinit)
.Lfpu_present:
.word PIC_SYM(_libc_arm_fpu_present, GOTOFF)
#endif /* !_STANDALONE */
WEAK_ALIAS(___longjmp, _longjmp)
ENTRY(_longjmp)
ldr r2, [r0] /* get magic from jmp_buf */
bic r3, r2, #(_JB_MAGIC__SETJMP ^ _JB_MAGIC__SETJMP_VFP)
/* ignore VFP-ness of magic */
ldr ip, .L_setjmp_magic /* load magic */
teq ip, r3 /* magic correct? */
teq ip, r2 /* magic correct? */
bne botch /* no, botch */
#if !defined(_STANDALONE)
teq r3, r2 /* did magic change? */
beq 1f /* no, don't restore VFP */
#if !defined(_STANDALONE) && __ARM_ARCH >= 6
add ip, r0, #(_JB_REG_D8 * 4)
vldmia ip, {d8-d15}
ldr ip, [r0, #(_JB_REG_FPSCR * 4)]
vmsr fpscr, ip
1:
#endif /* !_STANDALONE */
#endif /* !_STANDALONE && __ARM_ARCH >= 6 */
add r0, r0, #(_JB_REG_R4 * 4)
/* Restore integer registers */

View File

@ -64,23 +64,12 @@ ENTRY(setjmp)
ldr r1, .Lsetjmp_magic
ldr r2, .Lfpu_present
#ifdef PIC
GOT_INIT(r3, .Lsetjmp_got, .Lsetjmp_gotinit)
ldr r2, [r2, r3]
#else
ldr r2, [r2]
#endif
teq r2, #0 /* do we have a FPU? */
beq 1f /* no, don't save VFP registers */
orr r1, r1, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP)
/* change magic to VFP magic */
#if __ARM_ARCH >= 6
add r2, r0, #(_JB_REG_D8 * 4)
vstmia r2, {d8-d15}
vmrs r2, fpscr
str r2, [r0, #(_JB_REG_FPSCR * 4)]
1:
#endif
str r1, [r0] /* store magic */
@ -98,9 +87,6 @@ ENTRY(setjmp)
.Lsetjmp_magic:
.word _JB_MAGIC_SETJMP
GOT_INITSYM(.Lsetjmp_got, .Lsetjmp_gotinit)
.Lfpu_present:
.word PIC_SYM(_libc_arm_fpu_present, GOTOFF)
END(setjmp)
.weak _C_LABEL(longjmp)
@ -108,8 +94,7 @@ END(setjmp)
ENTRY(__longjmp)
ldr r2, [r0]
ldr ip, .Lsetjmp_magic
bic r3, r2, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP)
teq r3, ip
teq r2, ip
bne .Lbotch
/* Restore the signal mask. */
@ -120,14 +105,12 @@ ENTRY(__longjmp)
bl PIC_SYM(_C_LABEL(sigprocmask), PLT)
ldmfd sp!, {r0-r2, r14}
tst r2, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP)
/* is this a VFP magic? */
beq 1f /* no, don't restore VFP */
#if __ARM_ARCH >= 6
add ip, r0, #(_JB_REG_D8 * 4)
vldmia ip, {d8-d15}
ldr ip, [r0, #(_JB_REG_FPSCR * 4)]
vmsr fpscr, ip
1:
#endif
add r0, r0, #(_JB_REG_R4 * 4)
/* Restore integer registers */