15e53a4f9SPedro F. Giffuni /*- 25e53a4f9SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 35e53a4f9SPedro F. Giffuni * 4a091d823SDavid Xu * Copyright 2004 by Peter Grehan. All rights reserved. 5a091d823SDavid Xu * 6a091d823SDavid Xu * Redistribution and use in source and binary forms, with or without 7a091d823SDavid Xu * modification, are permitted provided that the following conditions 8a091d823SDavid Xu * are met: 9a091d823SDavid Xu * 1. Redistributions of source code must retain the above copyright 10a091d823SDavid Xu * notice, this list of conditions and the following disclaimer. 11a091d823SDavid Xu * 2. Redistributions in binary form must reproduce the above copyright 12a091d823SDavid Xu * notice, this list of conditions and the following disclaimer in the 13a091d823SDavid Xu * documentation and/or other materials provided with the distribution. 14a091d823SDavid Xu * 3. The name of the author may not be used to endorse or promote products 15a091d823SDavid Xu * derived from this software without specific prior written permission. 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, 22a091d823SDavid Xu * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23a091d823SDavid Xu * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24a091d823SDavid Xu * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25a091d823SDavid Xu * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26a091d823SDavid Xu * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27a091d823SDavid Xu * SUCH DAMAGE. 28a091d823SDavid Xu */ 29a091d823SDavid Xu 30a091d823SDavid Xu /* 31a091d823SDavid Xu * Machine-dependent thread prototypes/definitions. 32a091d823SDavid Xu */ 33a091d823SDavid Xu #ifndef _PTHREAD_MD_H_ 34a091d823SDavid Xu #define _PTHREAD_MD_H_ 35a091d823SDavid Xu 36a091d823SDavid Xu #include <sys/types.h> 3775395023SJohn Baldwin #include <machine/tls.h> 38a091d823SDavid Xu 39d99f6dacSDavid Xu #define CPU_SPINWAIT 40d99f6dacSDavid Xu 41c7904405SAndrew Turner /* For use in _Static_assert to check structs will fit in a page */ 42c7904405SAndrew Turner #define THR_PAGE_SIZE_MIN PAGE_SIZE 43c7904405SAndrew Turner 44a091d823SDavid Xu static __inline struct pthread * 45a091d823SDavid Xu _get_curthread(void) 46a091d823SDavid Xu { 47a091d823SDavid Xu if (_thr_initial) 488e61dbecSMarcel Moolenaar return (_tcb_get()->tcb_thread); 49a091d823SDavid Xu return (NULL); 50a091d823SDavid Xu } 51a091d823SDavid Xu 52*5670b8ccSMichal Meloun static __inline void 53*5670b8ccSMichal Meloun _thr_resolve_machdep(void) 54*5670b8ccSMichal Meloun { 55*5670b8ccSMichal Meloun } 56*5670b8ccSMichal Meloun 57a091d823SDavid Xu #endif /* _PTHREAD_MD_H_ */ 58