Home | History | Annotate | Line # | Download | only in sh3
      1  1.8  christos /*	$NetBSD: pthread_md.h,v 1.8 2011/01/25 19:12:06 christos Exp $ */
      2  1.1       uwe 
      3  1.1       uwe /*
      4  1.1       uwe  * Copyright 2003 Wasabi Systems, Inc.
      5  1.1       uwe  * All rights reserved.
      6  1.1       uwe  *
      7  1.1       uwe  * Written by Steve C. Woodford for Wasabi Systems, Inc.
      8  1.1       uwe  *
      9  1.1       uwe  * Redistribution and use in source and binary forms, with or without
     10  1.1       uwe  * modification, are permitted provided that the following conditions
     11  1.1       uwe  * are met:
     12  1.1       uwe  * 1. Redistributions of source code must retain the above copyright
     13  1.1       uwe  *    notice, this list of conditions and the following disclaimer.
     14  1.1       uwe  * 2. Redistributions in binary form must reproduce the above copyright
     15  1.1       uwe  *    notice, this list of conditions and the following disclaimer in the
     16  1.1       uwe  *    documentation and/or other materials provided with the distribution.
     17  1.1       uwe  * 3. All advertising materials mentioning features or use of this software
     18  1.1       uwe  *    must display the following acknowledgement:
     19  1.1       uwe  *      This product includes software developed for the NetBSD Project by
     20  1.1       uwe  *      Wasabi Systems, Inc.
     21  1.1       uwe  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
     22  1.1       uwe  *    or promote products derived from this software without specific prior
     23  1.1       uwe  *    written permission.
     24  1.1       uwe  *
     25  1.1       uwe  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
     26  1.1       uwe  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27  1.1       uwe  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28  1.1       uwe  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
     29  1.1       uwe  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30  1.1       uwe  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31  1.1       uwe  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32  1.1       uwe  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33  1.1       uwe  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34  1.1       uwe  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35  1.1       uwe  * POSSIBILITY OF SUCH DAMAGE.
     36  1.1       uwe  */
     37  1.1       uwe 
     38  1.1       uwe #ifndef _LIB_PTHREAD_SH3_MD_H
     39  1.1       uwe #define _LIB_PTHREAD_SH3_MD_H
     40  1.1       uwe 
     41  1.8  christos static inline unsigned long
     42  1.1       uwe pthread__sp(void)
     43  1.1       uwe {
     44  1.8  christos 	unsigned long ret;
     45  1.1       uwe 	__asm("mov r15, %0" : "=r" (ret));
     46  1.1       uwe 
     47  1.1       uwe 	return ret;
     48  1.1       uwe }
     49  1.1       uwe 
     50  1.1       uwe #define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[_REG_R15])
     51  1.1       uwe 
     52  1.2       uwe /*
     53  1.2       uwe  * Set initial, sane values for registers whose values aren't just
     54  1.2       uwe  * "don't care".
     55  1.2       uwe  */
     56  1.2       uwe #define _INITCONTEXT_U_MD(ucp)						\
     57  1.2       uwe 	(ucp)->uc_mcontext.__gregs[_REG_SR] = 0;
     58  1.1       uwe 
     59  1.4        ad /* sh3 will not go SMP */
     60  1.4        ad #define	PTHREAD__ATOMIC_IS_MEMBAR
     61  1.4        ad 
     62  1.1       uwe #endif /* _LIB_PTHREAD_SH3_MD_H */
     63