summaryrefslogtreecommitdiffstats
path: root/sys/lib/libkern/arch/sparc
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2011-03-12 18:50:05 +0000
committerderaadt <deraadt@openbsd.org>2011-03-12 18:50:05 +0000
commit6f046b4ae30b6a85f8b4af4b38579073ac883438 (patch)
tree0b48a85943f8eaeadbf22332e334bf2549af51b7 /sys/lib/libkern/arch/sparc
parentThere existed a race when a process was trying to read from a spliced (diff)
downloadwireguard-openbsd-6f046b4ae30b6a85f8b4af4b38579073ac883438.tar.xz
wireguard-openbsd-6f046b4ae30b6a85f8b4af4b38579073ac883438.zip
In the original sparc V7 book (and in the v8 book), the divrem leaf code used
local registers for a few temporaries. This was changed to use two global registers. Maybe to permit use in-kernel without conflicting with the register V7 register window handlers. (Was this done by Chris Torek? Is this related to Gordon Irlam's work? Or was it in NetBSD? Hard to tell because NetBSD removed their original cvs tree.) In V8 the ABI was tightened; more global registers became offlimits in different ways. We started supporting sun4m, and did not consider this. As a result, the global registers chosen are the wrong choice. In particular, %g7 is a poor choice for upcoming TLS work. It looks like it is safer to use %g5 and %g6 since these functions are "system software". All re-entrant parts of the system save it. On sparc64 these functions are in libc per ABI requirement, but are unused. On sparc, they occur in bootblocks (no reentrancy), kernel (reentrancy saves globals; kernel is not ABI compliant), userland libc (signal handlers save globals), and ld.so (symbol binding is not re-entrant on its own). Discussed rather extensively with guenther, kettenis, miod and drahn.
Diffstat (limited to 'sys/lib/libkern/arch/sparc')
-rw-r--r--sys/lib/libkern/arch/sparc/divrem.m44
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/lib/libkern/arch/sparc/divrem.m4 b/sys/lib/libkern/arch/sparc/divrem.m4
index 1651801009a..b7b5b609477 100644
--- a/sys/lib/libkern/arch/sparc/divrem.m4
+++ b/sys/lib/libkern/arch/sparc/divrem.m4
@@ -1,4 +1,4 @@
-/* $OpenBSD: divrem.m4,v 1.7 2007/11/24 19:47:05 deraadt Exp $ */
+/* $OpenBSD: divrem.m4,v 1.8 2011/03/12 18:50:07 deraadt Exp $ */
/* $NetBSD: divrem.m4,v 1.3 1995/04/22 09:37:39 pk Exp $ */
/*
@@ -88,7 +88,7 @@ define(V, `%o5')
/* m4 reminder: ifelse(a,b,c,d) => if a is b, then c, else d */
define(T, `%g1')
-define(SC, `%g7')
+define(SC, `%g5')
ifelse(S, `true', `define(SIGN, `%g6')')
/*