summaryrefslogtreecommitdiffstats
path: root/lib/libc/arch/sparc
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2016-03-20 02:32:39 +0000
committerguenther <guenther@openbsd.org>2016-03-20 02:32:39 +0000
commit5af055cd66b5450a4935ae30e5716331ca3b13d5 (patch)
tree6fa66dcb9c9653fb1659c185234178493d593968 /lib/libc/arch/sparc
parentPrepare for future ld.so/libc bump: update <tib.h> with the definitions (diff)
downloadwireguard-openbsd-5af055cd66b5450a4935ae30e5716331ca3b13d5.tar.xz
wireguard-openbsd-5af055cd66b5450a4935ae30e5716331ca3b13d5.zip
Rearrange C runtime bits: now that ld.so exports environ and __progname,
move their definitions and initialization in static links to libc.a Make crt0 always invoke a new func _csu_finish() in libc to process the auxv and to either register the ld.so cleanup function (in dynamic links) or initialize environ and __progname and do MC_DISABLE_KBIND (in static links). In libc, get pagesize from auxv; cache that between getpagesize() and sysconf(_SC_PAGESIZE) ok mpi@ "good time" deraadt@
Diffstat (limited to 'lib/libc/arch/sparc')
-rw-r--r--lib/libc/arch/sparc/gdtoa/kbind.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/libc/arch/sparc/gdtoa/kbind.h b/lib/libc/arch/sparc/gdtoa/kbind.h
new file mode 100644
index 00000000000..62db01ad881
--- /dev/null
+++ b/lib/libc/arch/sparc/gdtoa/kbind.h
@@ -0,0 +1,27 @@
+/* $OpenBSD: kbind.h,v 1.1 2016/03/20 02:32:39 guenther Exp $ */
+
+/*
+ * Copyright (c) 2016 Philip Guenther <guenther@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/syscall.h>
+
+#define MD_DISABLE_KBIND \
+ do { \
+ register long syscall_num __asm("g1") = SYS_kbind; \
+ register void *arg1 __asm("o0") = NULL; \
+ __asm volatile("t 0" : "+r" (arg1) : "r" (syscall_num) \
+ : "o1", "cc"); \
+ } while (0)