summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2020-12-13 21:21:32 +0000
committerbluhm <bluhm@openbsd.org>2020-12-13 21:21:32 +0000
commit4856180f9a2b3d6bc7e69d3b31e067e957f4b8b5 (patch)
tree43598f593391a79ba385aefe3d5fdc639198b59a
parentMake sure flow src and dst addresses have the same address family. (diff)
downloadwireguard-openbsd-4856180f9a2b3d6bc7e69d3b31e067e957f4b8b5.tar.xz
wireguard-openbsd-4856180f9a2b3d6bc7e69d3b31e067e957f4b8b5.zip
Geode CPU does not support SSE, so MXCSR does not exists there. As
our i386 compiler does not generate SSE instructions by default, it is not strictly necessary to save MXCSR content between setjmp(3) and longjmp(3). We do not want to end supporting such old processors now. Remove the stmxcsr and ldmxcsr instructions from libc. reported by Johan Huldtgren; OK jsg@ kettenis@
-rw-r--r--lib/libc/arch/i386/gen/_setjmp.S4
-rw-r--r--lib/libc/arch/i386/gen/setjmp.S4
-rw-r--r--lib/libc/arch/i386/gen/sigsetjmp.S4
-rw-r--r--sys/arch/i386/include/setjmp.h5
4 files changed, 5 insertions, 12 deletions
diff --git a/lib/libc/arch/i386/gen/_setjmp.S b/lib/libc/arch/i386/gen/_setjmp.S
index f1f5d99fd71..08030e2d9cb 100644
--- a/lib/libc/arch/i386/gen/_setjmp.S
+++ b/lib/libc/arch/i386/gen/_setjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: _setjmp.S,v 1.8 2020/12/06 18:13:15 bluhm Exp $ */
+/* $OpenBSD: _setjmp.S,v 1.9 2020/12/13 21:21:32 bluhm Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -63,7 +63,6 @@ ENTRY(_setjmp)
movl %ecx,(_JB_EBP * 4)(%eax)
movl %esi,(_JB_ESI * 4)(%eax)
movl %edi,(_JB_EDI * 4)(%eax)
- stmxcsr (_JB_MXCSR * 4)(%eax)
fnstcw (_JB_FCW * 4)(%eax)
xorl %eax,%eax
ret
@@ -75,7 +74,6 @@ ENTRY(_longjmp)
addl $__jmpxor-1b,%ecx # load cookie address
movl 4(%esp),%edx # parameter, pointer to env
movl 8(%esp),%eax # parameter, val
- ldmxcsr (_JB_MXCSR * 4)(%edx)
fldcw (_JB_FCW * 4)(%edx)
movl (_JB_EBX * 4)(%edx),%ebx
movl (_JB_ESP * 4)(%edx),%esi
diff --git a/lib/libc/arch/i386/gen/setjmp.S b/lib/libc/arch/i386/gen/setjmp.S
index 47104a3c8b8..9dbb4ffafc1 100644
--- a/lib/libc/arch/i386/gen/setjmp.S
+++ b/lib/libc/arch/i386/gen/setjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: setjmp.S,v 1.13 2020/12/06 18:13:15 bluhm Exp $ */
+/* $OpenBSD: setjmp.S,v 1.14 2020/12/13 21:21:32 bluhm Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -78,7 +78,6 @@ ENTRY(setjmp)
movl 8(%edx),%edx # load eip cookie over cookie address
xorl 0(%esp),%edx # caller address
movl %edx,(_JB_EIP * 4)(%ecx)
- stmxcsr (_JB_MXCSR * 4)(%ecx)
fnstcw (_JB_FCW * 4)(%ecx)
xorl %eax,%eax
ret
@@ -97,7 +96,6 @@ ENTRY(longjmp)
movl 4(%esp),%edx # parameter, pointer to env
movl 8(%esp),%eax # parameter, val
- ldmxcsr (_JB_MXCSR * 4)(%edx)
fldcw (_JB_FCW * 4)(%edx)
movl (_JB_EBX * 4)(%edx),%ebx
movl (_JB_ESP * 4)(%edx),%esi
diff --git a/lib/libc/arch/i386/gen/sigsetjmp.S b/lib/libc/arch/i386/gen/sigsetjmp.S
index 935d1514230..2c2013257bf 100644
--- a/lib/libc/arch/i386/gen/sigsetjmp.S
+++ b/lib/libc/arch/i386/gen/sigsetjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigsetjmp.S,v 1.12 2020/12/06 18:13:15 bluhm Exp $ */
+/* $OpenBSD: sigsetjmp.S,v 1.13 2020/12/13 21:21:32 bluhm Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -67,7 +67,6 @@ ENTRY(sigsetjmp)
movl 4(%edx),%edx # load eip cookie over cookie address
xorl 0(%esp),%edx
movl %edx,(_JB_EIP * 4)(%ecx)
- stmxcsr (_JB_MXCSR * 4)(%ecx)
fnstcw (_JB_FCW * 4)(%ecx)
xorl %eax,%eax
ret
@@ -91,7 +90,6 @@ ENTRY(siglongjmp)
movl 4(%esp),%edx # reload in case sigprocmask failed
movl 8(%esp),%eax # parameter, val
- ldmxcsr (_JB_MXCSR * 4)(%edx)
fldcw (_JB_FCW * 4)(%edx)
movl (_JB_EBX * 4)(%edx),%ebx
movl (_JB_ESP * 4)(%edx),%esi
diff --git a/sys/arch/i386/include/setjmp.h b/sys/arch/i386/include/setjmp.h
index d72d703d03b..b9c7867f9d2 100644
--- a/sys/arch/i386/include/setjmp.h
+++ b/sys/arch/i386/include/setjmp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: setjmp.h,v 1.3 2020/12/06 15:31:30 bluhm Exp $ */
+/* $OpenBSD: setjmp.h,v 1.4 2020/12/13 21:21:32 bluhm Exp $ */
/* $NetBSD: setjmp.h,v 1.1 1994/12/20 10:36:43 cgd Exp $ */
/*
@@ -13,7 +13,6 @@
#define _JB_EDI 5
#define _JB_SIGMASK 6
#define _JB_SIGFLAG 7
-#define _JB_MXCSR 8
-#define _JB_FCW 9
+#define _JB_FCW 8
#define _JBLEN 10 /* size, in longs, of a jmp_buf */