summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/amd64/include/tcb.h9
-rw-r--r--sys/arch/i386/include/tcb.h9
-rw-r--r--sys/arch/m88k/include/tcb.h24
-rw-r--r--sys/arch/sparc64/include/tcb.h10
4 files changed, 7 insertions, 45 deletions
diff --git a/sys/arch/amd64/include/tcb.h b/sys/arch/amd64/include/tcb.h
index 3f7c20981bd..b80efa78d5b 100644
--- a/sys/arch/amd64/include/tcb.h
+++ b/sys/arch/amd64/include/tcb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcb.h,v 1.3 2015/05/18 19:59:27 guenther Exp $ */
+/* $OpenBSD: tcb.h,v 1.4 2016/09/04 08:49:35 guenther Exp $ */
/*
* Copyright (c) 2011 Philip Guenther <guenther@openbsd.org>
@@ -29,8 +29,6 @@ void tcb_set(struct proc *_p, void *_newtcb);
#else /* _KERNEL */
-#include <stddef.h> /* for offsetof */
-
/* ELF TLS ABI calls for big TCB, with static TLS data at negative offsets */
#define TLS_VARIANT 2
@@ -46,12 +44,7 @@ __amd64_read_tcb(long offset)
/* Get a pointer to the TCB itself */
#define TCB_GET() __amd64_read_tcb(0)
-/* Get the value of a specific member in the TCB */
-#define TCB_GET_MEMBER(member) \
- __amd64_read_tcb(offsetof(struct thread_control_block, member))
-
/* Setting the TCB pointer can only be done via syscall, so no TCB_SET() */
#endif /* _KERNEL */
-
#endif /* _MACHINE_TCB_H_ */
diff --git a/sys/arch/i386/include/tcb.h b/sys/arch/i386/include/tcb.h
index 1769686224d..1c12ec2bc50 100644
--- a/sys/arch/i386/include/tcb.h
+++ b/sys/arch/i386/include/tcb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcb.h,v 1.3 2015/11/10 06:06:35 guenther Exp $ */
+/* $OpenBSD: tcb.h,v 1.4 2016/09/04 08:49:35 guenther Exp $ */
/*
* Copyright (c) 2011 Philip Guenther <guenther@openbsd.org>
*
@@ -30,8 +30,6 @@
#else /* _KERNEL */
-#include <stddef.h> /* for offsetof */
-
/* ELF TLS ABI calls for big TCB, with static TLS data at negative offsets */
#define TLS_VARIANT 2
@@ -47,12 +45,7 @@ __i386_read_tcb(int offset)
/* Get a pointer to the TCB itself */
#define TCB_GET() __i386_read_tcb(0)
-/* Get the value of a specific member in the TCB */
-#define TCB_GET_MEMBER(member) \
- __i386_read_tcb(offsetof(struct thread_control_block, member))
-
/* Setting the TCB pointer can only be done via syscall, so no TCB_SET() */
#endif /* _KERNEL */
-
#endif /* _MACHINE_TCB_H_ */
diff --git a/sys/arch/m88k/include/tcb.h b/sys/arch/m88k/include/tcb.h
index b71544f6fe1..b4c798ec33d 100644
--- a/sys/arch/m88k/include/tcb.h
+++ b/sys/arch/m88k/include/tcb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcb.h,v 1.3 2014/03/29 18:09:29 guenther Exp $ */
+/* $OpenBSD: tcb.h,v 1.4 2016/09/04 08:49:35 guenther Exp $ */
/*
* Copyright (c) 2011 Philip Guenther <guenther@openbsd.org>
@@ -24,7 +24,7 @@
* and register %r26 contains the address of the thread's errno.
* It is the responsibility of the kernel to set %r27 to the proper value
* when creating the thread, while initialization of %r26 is done in
- * userland within libpthread on a needed basis.
+ * userland within libc on an as-needed basis.
*/
#ifdef _KERNEL
@@ -48,16 +48,12 @@
#if defined(__GNUC__) && __GNUC__ > 4
-struct thread_control_block;
-__register__ struct thread_control_block *__tcb __asm__ ("%r27");
+register void *__tcb __asm__ ("%r27");
#define TCB_GET() (__tcb)
#define TCB_SET(tcb) ((__tcb) = (tcb))
-#define TCB_GET_MEMBER(member) ((void *)(__tcb->member))
#else /* __GNUC__ > 4 */
-#include <stddef.h> /* for offsetof */
-
/* Get a pointer to the TCB itself */
static inline void *
__m88k_get_tcb(void)
@@ -67,24 +63,10 @@ __m88k_get_tcb(void)
return val;
}
-/* Get the value of a specific member in the TCB */
-static inline void *
-__m88k_read_tcb(size_t offset)
-{
- void *val;
- /* XXX the `offset' constraint ought to be "I" but this causes a warning */
- __asm__ ("ld %0,%%r27,%1" : "=r" (val) : "r" (offset));
- return val;
-}
-
#define TCB_GET() __m88k_get_tcb()
#define TCB_SET(tcb) __asm volatile("or %%r27,%0,%r0" : : "r" (tcb))
-#define TCB_GET_MEMBER(member) \
- __m88k_read_tcb(offsetof(struct thread_control_block, member))
-
#endif /* __GNUC__ > 4 */
#endif /* _KERNEL */
-
#endif /* _MACHINE_TCB_H_ */
diff --git a/sys/arch/sparc64/include/tcb.h b/sys/arch/sparc64/include/tcb.h
index be2085070b0..49c6a36bbd2 100644
--- a/sys/arch/sparc64/include/tcb.h
+++ b/sys/arch/sparc64/include/tcb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcb.h,v 1.4 2014/03/29 18:09:30 guenther Exp $ */
+/* $OpenBSD: tcb.h,v 1.5 2016/09/04 08:49:35 guenther Exp $ */
/*
* Copyright (c) 2011 Philip Guenther <guenther@openbsd.org>
@@ -37,16 +37,13 @@
#define TLS_VARIANT 2
#if 0 /* XXX perhaps use the gcc global register extension? */
-struct thread_control_block;
-__register__ struct thread_control_block *__tcb __asm__ ("%g7");
+register void *__tcb __asm__ ("%g7");
#define TCB_GET() (__tcb)
#define TCB_GET_MEMBER(member) ((void *)(__tcb->member))
#define TCB_SET(tcb) ((__tcb) = (tcb))
#else
-#include <stddef.h> /* for offsetof */
-
/* Get a pointer to the TCB itself */
static inline void *
__sparc64_get_tcb(void)
@@ -65,13 +62,10 @@ __sparc64_read_tcb(int offset)
__asm__ ("ldx [%%g7 + %1], %0" : "=r" (val) : "r" (offset));
return val;
}
-#define TCB_GET_MEMBER(member) \
- __sparc64_read_tcb(offsetof(struct thread_control_block, member))
#define TCB_SET(tcb) __asm volatile("mov %0, %%g7" : : "r" (tcb))
#endif /* 0 */
#endif /* _KERNEL */
-
#endif /* _MACHINE_TCB_H_ */