xref: /freebsd/lib/libthr/arch/arm/include/pthread_md.h (revision c7904405a8d47f64c3b0e73158572e2dc8ef0217)
1a091d823SDavid Xu /*-
25e53a4f9SPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
35e53a4f9SPedro F. Giffuni  *
4a091d823SDavid Xu  * Copyright (c) 2005 David Xu <davidxu@freebsd.org>.
5a091d823SDavid Xu  * All rights reserved.
6a091d823SDavid Xu  *
7a091d823SDavid Xu  * Redistribution and use in source and binary forms, with or without
8a091d823SDavid Xu  * modification, are permitted provided that the following conditions
9a091d823SDavid Xu  * are met:
10a091d823SDavid Xu  *
11a091d823SDavid Xu  * 1. Redistributions of source code must retain the above copyright
12a091d823SDavid Xu  *    notice, this list of conditions and the following disclaimer.
13a091d823SDavid Xu  * 2. Redistributions in binary form must reproduce the above copyright
14a091d823SDavid Xu  *    notice, this list of conditions and the following disclaimer in the
15a091d823SDavid Xu  *    documentation and/or other materials provided with the distribution.
16a091d823SDavid Xu  *
17a091d823SDavid Xu  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18a091d823SDavid Xu  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19a091d823SDavid Xu  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20a091d823SDavid Xu  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21a091d823SDavid Xu  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22a091d823SDavid Xu  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23a091d823SDavid Xu  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24a091d823SDavid Xu  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25a091d823SDavid Xu  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26a091d823SDavid Xu  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27a091d823SDavid Xu  *
28a091d823SDavid Xu  * $FreeBSD$
29a091d823SDavid Xu  */
30a091d823SDavid Xu 
31a091d823SDavid Xu /*
32a091d823SDavid Xu  * Machine-dependent thread prototypes/definitions.
33a091d823SDavid Xu  */
34a091d823SDavid Xu #ifndef _PTHREAD_MD_H_
35a091d823SDavid Xu #define	_PTHREAD_MD_H_
36a091d823SDavid Xu 
37a091d823SDavid Xu #include <sys/types.h>
3875395023SJohn Baldwin #include <machine/tls.h>
39a091d823SDavid Xu 
40d99f6dacSDavid Xu #define	CPU_SPINWAIT
41a091d823SDavid Xu 
42*c7904405SAndrew Turner /* For use in _Static_assert to check structs will fit in a page */
43*c7904405SAndrew Turner #define	THR_PAGE_SIZE_MIN	PAGE_SIZE
44*c7904405SAndrew Turner 
45a091d823SDavid Xu static __inline struct pthread *
46a091d823SDavid Xu _get_curthread(void)
47a091d823SDavid Xu {
48a091d823SDavid Xu 	if (_thr_initial)
49a091d823SDavid Xu 		return (_tcb_get()->tcb_thread);
50a091d823SDavid Xu 	return (NULL);
51a091d823SDavid Xu }
52a091d823SDavid Xu 
53a091d823SDavid Xu #endif /* _PTHREAD_MD_H_ */
54