summaryrefslogtreecommitdiffstats
path: root/lib/libc/arch/sh
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2016-05-07 19:05:21 +0000
committerguenther <guenther@openbsd.org>2016-05-07 19:05:21 +0000
commitfe38b55cb0aae270de3f844146814682e8cd345c (patch)
tree9825cc8aa96314e8e79ea1802ccbc9349772680b /lib/libc/arch/sh
parentImplement ACPI 5.0 GeneralPurposeIo OpRegion support. This basically allows (diff)
downloadwireguard-openbsd-fe38b55cb0aae270de3f844146814682e8cd345c.tar.xz
wireguard-openbsd-fe38b55cb0aae270de3f844146814682e8cd345c.zip
Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable! Make libpthread dlopen'able by moving the cancelation wrappers into libc and doing locking and fork/errno handling via callbacks that libpthread registers when it first initializes. 'errno' *must* be declared via <errno.h> now! Clean up libpthread's symbol exports like libc. On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec. Testing by various, particularly sthen@ and patrick@ ok kettenis@
Diffstat (limited to 'lib/libc/arch/sh')
-rw-r--r--lib/libc/arch/sh/Makefile.inc3
-rw-r--r--lib/libc/arch/sh/SYS.h3
-rw-r--r--lib/libc/arch/sh/sys/Ovfork.S4
-rw-r--r--lib/libc/arch/sh/sys/cerror.S41
-rw-r--r--lib/libc/arch/sh/sys/fork.S41
-rw-r--r--lib/libc/arch/sh/sys/sigsuspend.S6
6 files changed, 25 insertions, 73 deletions
diff --git a/lib/libc/arch/sh/Makefile.inc b/lib/libc/arch/sh/Makefile.inc
index 69a13eed486..74ee41bf416 100644
--- a/lib/libc/arch/sh/Makefile.inc
+++ b/lib/libc/arch/sh/Makefile.inc
@@ -1 +1,2 @@
-# $OpenBSD: Makefile.inc,v 1.4 2007/03/02 06:11:54 miod Exp $
+# $OpenBSD: Makefile.inc,v 1.5 2016/05/07 19:05:22 guenther Exp $
+CERROR= cerror.S
diff --git a/lib/libc/arch/sh/SYS.h b/lib/libc/arch/sh/SYS.h
index c3b95350399..5458eee62d8 100644
--- a/lib/libc/arch/sh/SYS.h
+++ b/lib/libc/arch/sh/SYS.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: SYS.h,v 1.9 2015/10/23 04:39:24 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.10 2016/05/07 19:05:22 guenther Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -85,7 +85,6 @@
904:
#define CERROR _C_LABEL(__cerror)
-#define _CERROR _C_LABEL(___cerror)
#define _SYSCALL_NOERROR(x,y) \
SYSENTRY(x); \
diff --git a/lib/libc/arch/sh/sys/Ovfork.S b/lib/libc/arch/sh/sys/Ovfork.S
index a8d7d5e442e..ce21487d807 100644
--- a/lib/libc/arch/sh/sys/Ovfork.S
+++ b/lib/libc/arch/sh/sys/Ovfork.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: Ovfork.S,v 1.2 2015/03/31 04:32:02 guenther Exp $ */
+/* $OpenBSD: Ovfork.S,v 1.3 2016/05/07 19:05:22 guenther Exp $ */
/* $NetBSD: Ovfork.S,v 1.5 2003/08/07 16:42:20 agc Exp $ */
/*-
@@ -37,4 +37,4 @@
#include "SYS.h"
-RSYSCALL(vfork)
+RSYSCALL_HIDDEN(vfork)
diff --git a/lib/libc/arch/sh/sys/cerror.S b/lib/libc/arch/sh/sys/cerror.S
index 0740e7bb558..92e365571ff 100644
--- a/lib/libc/arch/sh/sys/cerror.S
+++ b/lib/libc/arch/sh/sys/cerror.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: cerror.S,v 1.5 2015/09/10 13:29:09 guenther Exp $ */
+/* $OpenBSD: cerror.S,v 1.6 2016/05/07 19:05:22 guenther Exp $ */
/* $NetBSD: cerror.S,v 1.10 2006/01/06 05:14:39 uwe Exp $ */
/*-
@@ -37,29 +37,22 @@
#include "SYS.h"
-WEAK_ALIAS(CERROR, _CERROR)
-
-ASENTRY(_CERROR)
-#ifdef __PIC__
- mova L_GOT, r0
- mov.l L_GOT, r1
- add r0, r1
- mov.l L_errno, r0
- mov.l @(r0, r1), r1
- mov.l r4, @r1
-#else
- mov.l L_errno, r1
- mov.l r4, @r1
-#endif
- mov #-1, r0
+ASENTRY(CERROR)
+ mov.l .L___errno, r1
+ PIC_PROLOGUE(.L_got)
+ sts.l pr, @-sp
+1: CALL r1
+ mov.l r4, @-sp ! save error code
+ mov.l @sp+, r4
+ lds.l @sp+, pr
+ PIC_EPILOGUE
+ mov.l r4, @r0
+ mov #-1, r1
rts
- mov #-1, r1
+ mov #-1, r0
.align 2
-#ifdef __PIC__
-L_GOT: .long _GLOBAL_OFFSET_TABLE_
-L_errno: .long _C_LABEL(errno)@GOT
-#else
-L_errno: .long _C_LABEL(errno)
-#endif
- SET_ENTRY_SIZE(_CERROR)
+.L_got: PIC_GOT_DATUM
+.L___errno: CALL_DATUM(_C_LABEL(__errno), 1b)
+ SET_ASENTRY_SIZE(CERROR)
+
diff --git a/lib/libc/arch/sh/sys/fork.S b/lib/libc/arch/sh/sys/fork.S
deleted file mode 100644
index 4ee5a0442df..00000000000
--- a/lib/libc/arch/sh/sys/fork.S
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $OpenBSD: fork.S,v 1.4 2015/04/07 01:27:07 guenther Exp $ */
-/* $NetBSD: fork.S,v 1.10 2006/01/06 05:11:29 uwe Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)fork.s 5.1 (Berkeley) 4/23/90
- */
-
-#include "SYS.h"
-
-RSYSCALL_HIDDEN(fork)
-WEAK_ALIAS(_thread_fork,_thread_sys_fork)
diff --git a/lib/libc/arch/sh/sys/sigsuspend.S b/lib/libc/arch/sh/sys/sigsuspend.S
index 2b1401bbcb2..f8aca89650d 100644
--- a/lib/libc/arch/sh/sys/sigsuspend.S
+++ b/lib/libc/arch/sh/sys/sigsuspend.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigsuspend.S,v 1.2 2015/09/10 13:29:09 guenther Exp $ */
+/* $OpenBSD: sigsuspend.S,v 1.3 2016/05/07 19:05:22 guenther Exp $ */
/* $NetBSD: sigsuspend.S,v 1.5 2003/08/07 16:42:21 agc Exp $ */
/*-
@@ -37,7 +37,7 @@
#include "SYS.h"
-SYSENTRY(sigsuspend)
+SYSENTRY_HIDDEN(sigsuspend)
mov r4, r0 /* fetch mask arg */
mov.l @r0, r0 /* indirect to mask arg */
mov r0, r4
@@ -53,4 +53,4 @@ SYSENTRY(sigsuspend)
.align 2
LSYS_sigsuspend:
.long SYS_sigsuspend
-SYSCALL_END(sigsuspend)
+SYSCALL_END_HIDDEN(sigsuspend)