2 * Copyright (c) 2003 Jake Burkholder <jake@freebsd.org>.
3 * Copyright (c) 2003 Marcel Moolenaar
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * Machine-dependent thread prototypes/definitions.
33 #ifndef _PTHREAD_MD_H_
34 #define _PTHREAD_MD_H_
40 #define DTV_OFFSET offsetof(struct tcb, tcb_dtv)
43 * Variant II tcb, first two members are required by rtld.
44 * %g7 points to the structure.
47 struct tcb *tcb_self; /* required by rtld */
48 void *tcb_dtv; /* required by rtld */
49 struct pthread *tcb_thread; /* our hook */
54 * The tcb constructors.
56 struct tcb *_tcb_ctor(struct pthread *, int);
57 void _tcb_dtor(struct tcb *);
59 /* Called from the thread to set its private data. */
61 _tcb_set(struct tcb *tcb)
64 __asm __volatile("mov %0, %%g7" : : "r" (tcb));
67 static __inline struct tcb *
70 register struct tcb *tp __asm("%g7");
75 static __inline struct pthread *
79 return (_tcb_get()->tcb_thread);
82 #define HAS__UMTX_OP_ERR 1
84 #endif /* _PTHREAD_MD_H_ */