xref: /netbsd-src/sys/arch/sh3/include/lwp_private.h (revision 16543c49052c820334cffc5c69b2afde18f02458)
1*16543c49Schristos /*	$NetBSD: lwp_private.h,v 1.1 2024/11/30 01:04:14 christos Exp $	*/
2*16543c49Schristos 
3*16543c49Schristos /*-
4*16543c49Schristos  * Copyright (c) 2001 The NetBSD Foundation, Inc.
5*16543c49Schristos  * All rights reserved.
6*16543c49Schristos  *
7*16543c49Schristos  * This code is derived from software contributed to The NetBSD Foundation
8*16543c49Schristos  * by Klaus Klein.
9*16543c49Schristos  *
10*16543c49Schristos  * Redistribution and use in source and binary forms, with or without
11*16543c49Schristos  * modification, are permitted provided that the following conditions
12*16543c49Schristos  * are met:
13*16543c49Schristos  * 1. Redistributions of source code must retain the above copyright
14*16543c49Schristos  *    notice, this list of conditions and the following disclaimer.
15*16543c49Schristos  * 2. Redistributions in binary form must reproduce the above copyright
16*16543c49Schristos  *    notice, this list of conditions and the following disclaimer in the
17*16543c49Schristos  *    documentation and/or other materials provided with the distribution.
18*16543c49Schristos  *
19*16543c49Schristos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20*16543c49Schristos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21*16543c49Schristos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22*16543c49Schristos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23*16543c49Schristos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*16543c49Schristos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*16543c49Schristos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*16543c49Schristos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*16543c49Schristos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*16543c49Schristos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*16543c49Schristos  * POSSIBILITY OF SUCH DAMAGE.
30*16543c49Schristos  */
31*16543c49Schristos 
32*16543c49Schristos #ifndef _SH3_LWP_PRIVATE_H_
33*16543c49Schristos #define _SH3_LWP_PRIVATE_H_
34*16543c49Schristos 
35*16543c49Schristos #include <sys/cdefs.h>
36*16543c49Schristos #include <sys/tls.h>
37*16543c49Schristos 
38*16543c49Schristos __BEGIN_DECLS
39*16543c49Schristos 
40*16543c49Schristos static __inline void *
41*16543c49Schristos __lwp_getprivate_fast(void)
42*16543c49Schristos {
43*16543c49Schristos 	register void *__gbr;
44*16543c49Schristos 
45*16543c49Schristos 	__asm volatile("stc gbr, %0" : "=r" (__gbr));
46*16543c49Schristos 
47*16543c49Schristos 	return __gbr;
48*16543c49Schristos }
49*16543c49Schristos 
50*16543c49Schristos __END_DECLS
51*16543c49Schristos 
52*16543c49Schristos #endif /* !_SH3_LWP_PRIVATE_H_ */
53