diff options
author | andrew <andrew@FreeBSD.org> | 2013-06-04 19:47:26 +0000 |
---|---|---|
committer | andrew <andrew@FreeBSD.org> | 2013-06-04 19:47:26 +0000 |
commit | 26032149e764765151d7db649af11e5ec34eda81 (patch) | |
tree | 0b0488ae5384d1c732c686da7c48941e158f420f /lib/libc/arm/gen/_setjmp.S | |
parent | feb6576ac7f0a71ab975784e250eb58c7c9d7640 (diff) | |
download | FreeBSD-src-26032149e764765151d7db649af11e5ec34eda81.zip FreeBSD-src-26032149e764765151d7db649af11e5ec34eda81.tar.gz |
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.
Diffstat (limited to 'lib/libc/arm/gen/_setjmp.S')
-rw-r--r-- | lib/libc/arm/gen/_setjmp.S | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/lib/libc/arm/gen/_setjmp.S b/lib/libc/arm/gen/_setjmp.S index 6594afb..ea2f427 100644 --- a/lib/libc/arm/gen/_setjmp.S +++ b/lib/libc/arm/gen/_setjmp.S @@ -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 |