summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkamil <kamil@NetBSD.org>2019-12-27 00:32:16 +0000
committerkamil <kamil@NetBSD.org>2019-12-27 00:32:16 +0000
commitd1b17eeb640b139e330df2233dbc19d693b0605a (patch)
tree92d24991c1115eaf46b7d420f83868ab5b8e89e0
parente6c5fb7b84b56cc06ce1b333c04bc1ab511430c9 (diff)
Harmonize the namespace of fast TLS base pointer getter functions
Protect __lwp_getprivate_fast() with _RTLD_SOURCE, _LIBC_SOURCE and __LIBPTHREAD_SOURCE__. Include in this namespace <sys/tcl.h> and use __BEGIN_DECLS/__END_DECLS for the sake of consistency.
-rw-r--r--sys/arch/alpha/include/mcontext.h10
-rw-r--r--sys/arch/amd64/include/mcontext.h10
-rw-r--r--sys/arch/hppa/include/mcontext.h10
-rw-r--r--sys/arch/i386/include/mcontext.h10
-rw-r--r--sys/arch/ia64/include/mcontext.h10
-rw-r--r--sys/arch/sh3/include/mcontext.h10
-rw-r--r--sys/arch/sparc/include/mcontext.h10
-rw-r--r--sys/arch/vax/include/mcontext.h9
8 files changed, 70 insertions, 9 deletions
diff --git a/sys/arch/alpha/include/mcontext.h b/sys/arch/alpha/include/mcontext.h
index d078cf1b19b..235f22f4844 100644
--- a/sys/arch/alpha/include/mcontext.h
+++ b/sys/arch/alpha/include/mcontext.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mcontext.h,v 1.9 2018/02/15 15:53:56 kamil Exp $ */
+/* $NetBSD: mcontext.h,v 1.10 2019/12/27 00:32:16 kamil Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -102,6 +102,11 @@ typedef struct {
#define _UC_MACHINE_SET_PC(uc, pc) _UC_MACHINE_PC(uc) = (pc)
+#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || \
+ defined(__LIBPTHREAD_SOURCE__)
+#include <sys/tls.h>
+
+__BEGIN_DECLS
static __inline void *
__lwp_getprivate_fast(void)
{
@@ -113,5 +118,8 @@ __lwp_getprivate_fast(void)
return __tmp;
}
+__END_DECLS
+
+#endif
#endif /* !_ALPHA_MCONTEXT_H_ */
diff --git a/sys/arch/amd64/include/mcontext.h b/sys/arch/amd64/include/mcontext.h
index e8790d78c13..0c747e149ec 100644
--- a/sys/arch/amd64/include/mcontext.h
+++ b/sys/arch/amd64/include/mcontext.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mcontext.h,v 1.19 2018/02/15 15:53:56 kamil Exp $ */
+/* $NetBSD: mcontext.h,v 1.20 2019/12/27 00:32:16 kamil Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -84,6 +84,11 @@ typedef struct {
#define __UCONTEXT_SIZE 784
+#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || \
+ defined(__LIBPTHREAD_SOURCE__)
+#include <sys/tls.h>
+
+__BEGIN_DECLS
static __inline void *
__lwp_getprivate_fast(void)
{
@@ -93,6 +98,9 @@ __lwp_getprivate_fast(void)
return __tmp;
}
+__END_DECLS
+
+#endif
#ifdef _KERNEL
diff --git a/sys/arch/hppa/include/mcontext.h b/sys/arch/hppa/include/mcontext.h
index 3f0c10135e5..588b27cb4af 100644
--- a/sys/arch/hppa/include/mcontext.h
+++ b/sys/arch/hppa/include/mcontext.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mcontext.h,v 1.10 2018/02/27 11:26:39 kamil Exp $ */
+/* $NetBSD: mcontext.h,v 1.11 2019/12/27 00:32:17 kamil Exp $ */
#ifndef _HPPA_MCONTEXT_H_
#define _HPPA_MCONTEXT_H_
@@ -59,6 +59,11 @@ do { \
} while (/*CONSTCOND*/0)
#define _UC_MACHINE_INTRV(uc) ((uc)->uc_mcontext.__gregs[_REG_RET0])
+#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || \
+ defined(__LIBPTHREAD_SOURCE__)
+#include <sys/tls.h>
+
+__BEGIN_DECLS
static __inline void *
__lwp_getprivate_fast(void)
{
@@ -68,6 +73,9 @@ __lwp_getprivate_fast(void)
return __tmp;
}
+__END_DECLS
+
+#endif
#endif /* !__ASSEMBLER__ */
diff --git a/sys/arch/i386/include/mcontext.h b/sys/arch/i386/include/mcontext.h
index a1995ecc78b..8a75bcf7d02 100644
--- a/sys/arch/i386/include/mcontext.h
+++ b/sys/arch/i386/include/mcontext.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mcontext.h,v 1.14 2018/02/15 15:53:56 kamil Exp $ */
+/* $NetBSD: mcontext.h,v 1.15 2019/12/27 00:32:17 kamil Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -113,6 +113,11 @@ typedef struct {
#define __UCONTEXT_SIZE 776
+#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || \
+ defined(__LIBPTHREAD_SOURCE__)
+#include <sys/tls.h>
+
+__BEGIN_DECLS
static __inline void *
__lwp_getprivate_fast(void)
{
@@ -122,5 +127,8 @@ __lwp_getprivate_fast(void)
return __tmp;
}
+__END_DECLS
+
+#endif
#endif /* !_I386_MCONTEXT_H_ */
diff --git a/sys/arch/ia64/include/mcontext.h b/sys/arch/ia64/include/mcontext.h
index 7aa82264874..1b6b05f309b 100644
--- a/sys/arch/ia64/include/mcontext.h
+++ b/sys/arch/ia64/include/mcontext.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mcontext.h,v 1.9 2019/06/17 15:08:34 kamil Exp $ */
+/* $NetBSD: mcontext.h,v 1.10 2019/12/27 00:32:17 kamil Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -117,10 +117,18 @@ typedef struct __mcontext {
#define _UC_MACHINE_INTRV(uc) ((uc)->uc_mcontext.__gregs[8])
#define _UC_MACHINE_SET_PC(uc, pc) (uc)->uc_mcontext.mc_special.iip = (pc)
+#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || \
+ defined(__LIBPTHREAD_SOURCE__)
+#include <sys/tls.h>
+
+__BEGIN_DECLS
static __inline void *
__lwp_getprivate_fast(void)
{
return (void*)0;
}
+__END_DECLS
+
+#endif
#endif /* !_IA64_MCONTEXT_H_ */
diff --git a/sys/arch/sh3/include/mcontext.h b/sys/arch/sh3/include/mcontext.h
index f53c016d863..4ad168be98c 100644
--- a/sys/arch/sh3/include/mcontext.h
+++ b/sys/arch/sh3/include/mcontext.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mcontext.h,v 1.11 2018/02/15 15:53:57 kamil Exp $ */
+/* $NetBSD: mcontext.h,v 1.12 2019/12/27 00:32:17 kamil Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -95,6 +95,11 @@ typedef struct {
#define _UC_CLRSTACK 0x20000
#define _UC_TLSBASE 0x80000
+#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || \
+ defined(__LIBPTHREAD_SOURCE__)
+#include <sys/tls.h>
+
+__BEGIN_DECLS
static __inline void *
__lwp_getprivate_fast(void)
{
@@ -104,5 +109,8 @@ __lwp_getprivate_fast(void)
return __gbr;
}
+__END_DECLS
+
+#endif
#endif /* !_SH3_MCONTEXT_H_ */
diff --git a/sys/arch/sparc/include/mcontext.h b/sys/arch/sparc/include/mcontext.h
index 5c1fa9c8457..c58feee22f5 100644
--- a/sys/arch/sparc/include/mcontext.h
+++ b/sys/arch/sparc/include/mcontext.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mcontext.h,v 1.17 2018/02/19 08:31:13 mrg Exp $ */
+/* $NetBSD: mcontext.h,v 1.18 2019/12/27 00:32:17 kamil Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -161,6 +161,11 @@ do { \
(uc)->uc_mcontext.__gregs[_REG_nPC] = (pc) + 4; \
} while (/*CONSTCOND*/0)
+#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || \
+ defined(__LIBPTHREAD_SOURCE__)
+#include <sys/tls.h>
+
+__BEGIN_DECLS
static __inline void *
__lwp_getprivate_fast(void)
{
@@ -170,5 +175,8 @@ __lwp_getprivate_fast(void)
return __tmp;
}
+__END_DECLS
+
+#endif
#endif /* !_SPARC_MCONTEXT_H_ */
diff --git a/sys/arch/vax/include/mcontext.h b/sys/arch/vax/include/mcontext.h
index e77670e2d39..aef0f71ec9d 100644
--- a/sys/arch/vax/include/mcontext.h
+++ b/sys/arch/vax/include/mcontext.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mcontext.h,v 1.9 2018/02/15 15:53:57 kamil Exp $ */
+/* $NetBSD: mcontext.h,v 1.10 2019/12/27 00:32:17 kamil Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -74,9 +74,12 @@ typedef struct {
#define _UC_MACHINE_SET_PC(uc, pc) _UC_MACHINE_PC(uc) = (pc)
-#ifndef _KERNEL
+#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || \
+ defined(__LIBPTHREAD_SOURCE__)
+#include <sys/tls.h>
#include <sys/syscall.h>
+__BEGIN_DECLS
static __inline void *
__lwp_getprivate_fast(void)
{
@@ -84,6 +87,8 @@ __lwp_getprivate_fast(void)
__asm("chmk %0" :: "i"(SYS__lwp_getprivate) : "r0");
return tcb;
}
+__END_DECLS
+
#endif
#endif /* !_VAX_MCONTEXT_H_ */