From 4a2d94b24f6c114d4f5515899a3254df78d58f34 Mon Sep 17 00:00:00 2001 From: visa <> Date: Thu, 20 Apr 2017 16:07:52 +0000 Subject: Get TCB address using the RDHWR instruction instead of __get_tcb(). This gives fast access to the address on systems that implement the UserLocal register. TCB caching is still used when running in the single-threaded mode in order not to penalize old systems. The kernel counterpart of this change must be in place before using this diff! With guenther@ --- src/lib/libc/include/cancel.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/libc/include/cancel.h b/src/lib/libc/include/cancel.h index a858b80a1c..ada417d3e1 100644 --- a/src/lib/libc/include/cancel.h +++ b/src/lib/libc/include/cancel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cancel.h,v 1.2 2016/05/10 05:42:31 guenther Exp $ */ +/* $OpenBSD: cancel.h,v 1.3 2017/04/20 16:07:52 visa Exp $ */ /* * Copyright (c) 2015 Philip Guenther * @@ -26,11 +26,12 @@ __BEGIN_HIDDEN_DECLS __dead void _thread_canceled(void); __END_HIDDEN_DECLS -#ifdef __LIBC__ +#if defined(__LIBC__) && !defined(TCB_HAVE_MD_SET) /* - * Redirect macros that would use the syscall to instead use our callback + * Override TIB_GET macro to use the caching callback */ -#define __get_tcb() _thread_cb.tc_tcb() +#undef TIB_GET +#define TIB_GET() TCB_TO_TIB(_thread_cb.tc_tcb()) #endif #define PREP_CANCEL_POINT(tib) \ -- cgit v1.2.3-55-g6feb