Start to merge the updated ARM NetBSD setjump/longjmp functions. To begin
with merge the functions but leave out the code to save/load the VFP registers as that requires other changes to ensure the VFP is enabled first. This removes storing the old fpa registers. These were never fully supported, and the only user of this code I can find have moved to newer CPUs which use a VFP.
This commit is contained in:
parent
a42159f0ee
commit
8ed717de58
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251392
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _setjmp.S,v 1.5 2003/04/05 23:08:51 bjh21 Exp $ */
|
||||
/* $NetBSD: _setjmp.S,v 1.12 2013/04/19 13:45:45 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Mark Brinicombe
|
||||
@ -32,7 +32,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if !defined(__SOFTFP__) && !defined(__VFP_FP__) && !defined(__ARM_PCS)
|
||||
#error FPA is not supported anymore
|
||||
#endif
|
||||
|
||||
#ifdef __ARM_EABI__
|
||||
.fpu vfp
|
||||
#endif
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <machine/setjmp.h>
|
||||
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
@ -45,21 +55,15 @@ __FBSDID("$FreeBSD$");
|
||||
* The previous signal state is NOT restored.
|
||||
*
|
||||
* Note: r0 is the return value
|
||||
* r1-r3 are scratch registers in functions
|
||||
* r1-r3,ip are scratch registers in functions
|
||||
*/
|
||||
|
||||
ENTRY(_setjmp)
|
||||
ldr r1, .L_setjmp_magic
|
||||
str r1, [r0], #4
|
||||
#ifdef __SOFTFP__
|
||||
add r0, r0, #52
|
||||
#else
|
||||
/* Store fp registers */
|
||||
sfm f4, 4, [r0], #48
|
||||
/* Store fpsr */
|
||||
rfs r1
|
||||
str r1, [r0], #0x0004
|
||||
#endif /* __SOFTFP__ */
|
||||
|
||||
str r1, [r0]
|
||||
|
||||
add r0, r0, #(_JB_REG_R4 * 4)
|
||||
/* Store integer registers */
|
||||
stmia r0, {r4-r14}
|
||||
|
||||
@ -71,20 +75,12 @@ ENTRY(_setjmp)
|
||||
|
||||
WEAK_ALIAS(___longjmp, _longjmp)
|
||||
ENTRY(_longjmp)
|
||||
ldr r2, .L_setjmp_magic
|
||||
ldr r3, [r0], #4
|
||||
teq r2, r3
|
||||
bne botch
|
||||
ldr r2, [r0] /* get magic from jmp_buf */
|
||||
ldr ip, .L_setjmp_magic /* load magic */
|
||||
teq ip, r2 /* magic correct? */
|
||||
bne botch /* no, botch */
|
||||
|
||||
#ifdef __SOFTFP__
|
||||
add r0, r0, #52
|
||||
#else
|
||||
/* Restore fp registers */
|
||||
lfm f4, 4, [r0], #48
|
||||
/* Restore fpsr */
|
||||
ldr r4, [r0], #0x0004
|
||||
wfs r4
|
||||
#endif /* __SOFTFP__ */
|
||||
add r0, r0, #(_JB_REG_R4 * 4)
|
||||
/* Restore integer registers */
|
||||
ldmia r0, {r4-r14}
|
||||
|
||||
@ -94,8 +90,7 @@ ENTRY(_longjmp)
|
||||
beq botch
|
||||
|
||||
/* Set return value */
|
||||
mov r0, r1
|
||||
teq r0, #0x00000000
|
||||
movs r0, r1
|
||||
moveq r0, #0x00000001
|
||||
RET
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: setjmp.S,v 1.5 2003/04/05 23:08:51 bjh21 Exp $ */
|
||||
/* $NetBSD: setjmp.S,v 1.14 2013/04/19 13:45:45 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Mark Brinicombe
|
||||
@ -32,8 +32,15 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if !defined(__SOFTFP__) && !defined(__VFP_FP__) && !defined(__ARM_PCS)
|
||||
#error FPA is not supported anymore
|
||||
#endif
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <machine/setjmp.h>
|
||||
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* C library -- setjmp, longjmp
|
||||
*
|
||||
@ -47,27 +54,17 @@ __FBSDID("$FreeBSD$");
|
||||
ENTRY(setjmp)
|
||||
/* Block all signals and retrieve the old signal mask */
|
||||
stmfd sp!, {r0, r14}
|
||||
add r2, r0, #(25 * 4) /* oset */
|
||||
mov r0, #0x00000001 /* SIG_BLOCK */
|
||||
mov r1, #0 /* set */
|
||||
|
||||
add r2, r0, #(_JB_SIGMASK * 4) /* oset */
|
||||
mov r1, #0x00000000 /* set */
|
||||
mov r0, #0x00000001 /* SIG_BLOCK */
|
||||
bl PIC_SYM(_C_LABEL(sigprocmask), PLT)
|
||||
|
||||
ldmfd sp!, {r0, r14}
|
||||
|
||||
ldr r1, .Lsetjmp_magic
|
||||
str r1, [r0], #4
|
||||
str r1, [r0] /* store magic */
|
||||
|
||||
#ifdef __SOFTFP__
|
||||
add r0, r0, #52
|
||||
#else
|
||||
/* Store fp registers */
|
||||
sfm f4, 4, [r0], #48
|
||||
/* Store fpsr */
|
||||
rfs r1
|
||||
str r1, [r0], #0x0004
|
||||
#endif /* __SOFTFP__ */
|
||||
/* Store integer registers */
|
||||
add r0, r0, #(_JB_REG_R4 * 4)
|
||||
stmia r0, {r4-r14}
|
||||
mov r0, #0x00000000
|
||||
RET
|
||||
@ -79,51 +76,36 @@ ENTRY(setjmp)
|
||||
.weak _C_LABEL(longjmp)
|
||||
.set _C_LABEL(longjmp), _C_LABEL(__longjmp)
|
||||
ENTRY(__longjmp)
|
||||
ldr r2, .Lsetjmp_magic
|
||||
ldr r3, [r0]
|
||||
teq r2, r3
|
||||
bne botch
|
||||
ldr r2, [r0]
|
||||
ldr ip, .Lsetjmp_magic
|
||||
bic r3, r2, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP)
|
||||
teq r3, ip
|
||||
bne .Lbotch
|
||||
|
||||
|
||||
/* Set signal mask */
|
||||
stmfd sp!, {r0, r1, r14}
|
||||
sub sp, sp, #4 /* align the stack */
|
||||
|
||||
add r1, r0, #(25 * 4) /* Signal mask */
|
||||
mov r0, #3 /* SIG_SETMASK */
|
||||
mov r2, #0
|
||||
/* Restore the signal mask. */
|
||||
stmfd sp!, {r0-r2, r14}
|
||||
mov r2, #0x00000000
|
||||
add r1, r0, #(_JB_SIGMASK * 4) /* Signal mask */
|
||||
mov r0, #3 /* SIG_SETMASK */
|
||||
bl PIC_SYM(_C_LABEL(sigprocmask), PLT)
|
||||
ldmfd sp!, {r0-r2, r14}
|
||||
|
||||
add sp, sp, #4 /* unalign the stack */
|
||||
ldmfd sp!, {r0, r1, r14}
|
||||
|
||||
add r0, r0, #4
|
||||
#ifdef __SOFTFP__
|
||||
add r0, r0, #52
|
||||
#else
|
||||
/* Restore fp registers */
|
||||
lfm f4, 4, [r0], #48
|
||||
/* Restore FPSR */
|
||||
ldr r4, [r0], #0x0004
|
||||
wfs r4
|
||||
#endif /* __SOFTFP__ */
|
||||
add r0, r0, #(_JB_REG_R4 * 4)
|
||||
/* Restore integer registers */
|
||||
ldmia r0, {r4-r14}
|
||||
|
||||
/* Validate sp and r14 */
|
||||
teq sp, #0
|
||||
teqne r14, #0
|
||||
beq botch
|
||||
beq .Lbotch
|
||||
|
||||
/* Set return value */
|
||||
|
||||
mov r0, r1
|
||||
teq r0, #0x00000000
|
||||
movs r0, r1
|
||||
moveq r0, #0x00000001
|
||||
RET
|
||||
|
||||
/* validation failed, die die die. */
|
||||
botch:
|
||||
.Lbotch:
|
||||
bl PIC_SYM(_C_LABEL(longjmperror), PLT)
|
||||
bl PIC_SYM(_C_LABEL(abort), PLT)
|
||||
b . - 8 /* Cannot get here */
|
||||
|
Loading…
Reference in New Issue
Block a user