summaryrefslogtreecommitdiff
path: root/lib/libc/arch/arm
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2018-06-22 15:18:51 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2018-06-22 15:18:51 +0000
commit1cc668a6e4e90a6df9827274ac8ad872d12a53f8 (patch)
tree58efacb6db291e36d71dacd3955224459727075d /lib/libc/arch/arm
parent9cd939fb7466279e8657a832e36c8d007b3ac403 (diff)
Save and restore the relevant FPU state on armv7.
ok deraadt@
Diffstat (limited to 'lib/libc/arch/arm')
-rw-r--r--lib/libc/arch/arm/Makefile.inc4
-rw-r--r--lib/libc/arch/arm/gen/_setjmp.S22
-rw-r--r--lib/libc/arch/arm/gen/setjmp.S28
3 files changed, 26 insertions, 28 deletions
diff --git a/lib/libc/arch/arm/Makefile.inc b/lib/libc/arch/arm/Makefile.inc
index 6ca8e6e4f51..4d470b67b1e 100644
--- a/lib/libc/arch/arm/Makefile.inc
+++ b/lib/libc/arch/arm/Makefile.inc
@@ -1,12 +1,10 @@
-# $OpenBSD: Makefile.inc,v 1.8 2018/02/28 11:16:54 kettenis Exp $
+# $OpenBSD: Makefile.inc,v 1.9 2018/06/22 15:18:50 kettenis Exp $
# $NetBSD: Makefile.inc,v 1.5 2002/07/10 04:29:06 thorpej Exp $
.include <bsd.own.mk>
CERROR= cerror.S
-CPPFLAGS += -DSOFTFLOAT
-
# Override softfloat implementations of FP mode control functions
.PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/gen
diff --git a/lib/libc/arch/arm/gen/_setjmp.S b/lib/libc/arch/arm/gen/_setjmp.S
index adc06de6ee9..4e6f05e5c40 100644
--- a/lib/libc/arch/arm/gen/_setjmp.S
+++ b/lib/libc/arch/arm/gen/_setjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: _setjmp.S,v 1.5 2016/08/07 02:02:57 guenther Exp $ */
+/* $OpenBSD: _setjmp.S,v 1.6 2018/06/22 15:18:50 kettenis Exp $ */
/* $NetBSD: _setjmp.S,v 1.5 2003/04/05 23:08:51 bjh21 Exp $ */
/*
@@ -69,13 +69,13 @@ ENTRY(_setjmp)
eor r3, lr, r3 /* r3 = lr ^ __jmpxor[1] */
#ifdef SOFTFLOAT
- add r0, r0, #52
+ add r0, r0, #68
#else
+ /* Store fpcsr */
+ vmrs r1, fpscr
+ str r1, [r0], #4
/* Store fp registers */
- sfm f4, 4, [r0], #48
- /* Store fpsr */
- rfs r1
- str r1, [r0], #0x0004
+ vstmia r0!, {d8-d15}
#endif /* SOFTFLOAT */
/* Store integer registers */
stmia r0, {r2-r11}
@@ -98,13 +98,13 @@ ENTRY(_longjmp)
bne botch
#ifdef SOFTFLOAT
- add r0, r0, #52
+ add r0, r0, #68
#else
+ /* Restore fpcsr */
+ ldr r4, [r0], #4
+ vmsr fpscr, r4
/* Restore fp registers */
- lfm f4, 4, [r0], #48
- /* Restore fpsr */
- ldr r4, [r0], #0x0004
- wfs r4
+ vldmia r0!, {d8-d15}
#endif /* SOFTFLOAT */
/* Restore integer registers */
ldmia r0, {r2-r11}
diff --git a/lib/libc/arch/arm/gen/setjmp.S b/lib/libc/arch/arm/gen/setjmp.S
index 7edb8b3d7f7..03ed693520c 100644
--- a/lib/libc/arch/arm/gen/setjmp.S
+++ b/lib/libc/arch/arm/gen/setjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: setjmp.S,v 1.6 2016/08/07 02:02:57 guenther Exp $ */
+/* $OpenBSD: setjmp.S,v 1.7 2018/06/22 15:18:50 kettenis Exp $ */
/* $NetBSD: setjmp.S,v 1.5 2003/04/05 23:08:51 bjh21 Exp $ */
/*
@@ -56,7 +56,7 @@ ENTRY(setjmp)
SYSTRAP(sigprocmask)
/* Store signal mask */
- str r0, [r2, #(25 * 4)]
+ str r0, [r2, #(29 * 4)]
ldr r1, .Lsetjmp_magic
str r1, [r2], #4
@@ -69,14 +69,14 @@ ENTRY(setjmp)
eor r3, lr, r3 /* r3 = lr ^ __jmpxor[1] */
#ifdef SOFTFLOAT
- add r2, r2, #52
+ add r2, r2, #68
#else
+ /* Store fpcsr */
+ vmrs r1, fpscr
+ str r1, [r2], #4
/* Store fp registers */
- sfm f4, 4, [r2], #48
- /* Store fpsr */
- rfs r1
- str r1, [r2], #0x0004
-#endif /*SOFTFLOAT*/
+ vstmia r2!, {d8-d15}
+#endif /* SOFTFLOAT */
/* Store integer registers */
stmia r2, {r3-r12}
@@ -101,19 +101,19 @@ ENTRY(longjmp)
/* Fetch signal mask and call sigprocmask */
mov r3, r0 /* r3 = jmpbuf */
mov r2, r1 /* r2 = retvalue */
- ldr r1, [r0, #(25 * 4)]
+ ldr r1, [r0, #(29 * 4)]
mov r0, #0x00000003 /* SIG_SETMASK */
SYSTRAP(sigprocmask)
add r3, r3, #4
#ifdef SOFTFLOAT
- add r3, r3, #52
+ add r3, r3, #68
#else
+ /* Restore fpcsr */
+ ldr r4, [r3], #4
+ vmsr fpscr, r4
/* Restore fp registers */
- lfm f4, 4, [r3], #48
- /* Restore FPSR */
- ldr r4, [r3], #0x0004
- wfs r4
+ vldmia r3!, {d8-d15}
#endif /* SOFTFLOAT */
/* Restore integer registers */
ldmia r3, {r3-r12}