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 * $FreeBSD$ 30a091d823SDavid Xu */ 31a091d823SDavid Xu 32a091d823SDavid Xu /* 33a091d823SDavid Xu * Machine-dependent thread prototypes/definitions. 34a091d823SDavid Xu */ 35a091d823SDavid Xu #ifndef _PTHREAD_MD_H_ 36a091d823SDavid Xu #define _PTHREAD_MD_H_ 37a091d823SDavid Xu 38a091d823SDavid Xu #include <sys/types.h> 3975395023SJohn Baldwin #include <machine/tls.h> 40a091d823SDavid Xu 41d99f6dacSDavid Xu #define CPU_SPINWAIT 42d99f6dacSDavid Xu 43*c7904405SAndrew Turner /* For use in _Static_assert to check structs will fit in a page */ 44*c7904405SAndrew Turner #define THR_PAGE_SIZE_MIN PAGE_SIZE 45*c7904405SAndrew Turner 46a091d823SDavid Xu static __inline struct pthread * 47a091d823SDavid Xu _get_curthread(void) 48a091d823SDavid Xu { 49a091d823SDavid Xu if (_thr_initial) 508e61dbecSMarcel Moolenaar return (_tcb_get()->tcb_thread); 51a091d823SDavid Xu return (NULL); 52a091d823SDavid Xu } 53a091d823SDavid Xu 54bdccf0bbSBrandon Bergren #define HAS__UMTX_OP_ERR 1 55bdccf0bbSBrandon Bergren 56a091d823SDavid Xu #endif /* _PTHREAD_MD_H_ */ 57