1*c5d359beSchristos /* $NetBSD: pthread_md.h,v 1.8 2011/01/25 19:12:06 christos Exp $ */
29eecca32Smatt
39eecca32Smatt /*-
49eecca32Smatt * Copyright (c) 2001 The NetBSD Foundation, Inc.
59eecca32Smatt * All rights reserved.
69eecca32Smatt *
79eecca32Smatt * This code is derived from software contributed to The NetBSD Foundation
89eecca32Smatt * by Nathan J. Williams.
99eecca32Smatt *
109eecca32Smatt * Redistribution and use in source and binary forms, with or without
119eecca32Smatt * modification, are permitted provided that the following conditions
129eecca32Smatt * are met:
139eecca32Smatt * 1. Redistributions of source code must retain the above copyright
149eecca32Smatt * notice, this list of conditions and the following disclaimer.
159eecca32Smatt * 2. Redistributions in binary form must reproduce the above copyright
169eecca32Smatt * notice, this list of conditions and the following disclaimer in the
179eecca32Smatt * documentation and/or other materials provided with the distribution.
189eecca32Smatt *
199eecca32Smatt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
209eecca32Smatt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
219eecca32Smatt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
229eecca32Smatt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
239eecca32Smatt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
249eecca32Smatt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
259eecca32Smatt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
269eecca32Smatt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
279eecca32Smatt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
289eecca32Smatt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
299eecca32Smatt * POSSIBILITY OF SUCH DAMAGE.
309eecca32Smatt */
319eecca32Smatt
329eecca32Smatt #ifndef _LIB_PTHREAD_VAX_MD_H
339eecca32Smatt #define _LIB_PTHREAD_VAX_MD_H
349eecca32Smatt
35*c5d359beSchristos static inline unsigned long
pthread__sp(void)369eecca32Smatt pthread__sp(void)
379eecca32Smatt {
38*c5d359beSchristos unsigned long ret;
399eecca32Smatt
40aa6dda7bSmatt __asm("movl %%sp,%0" : "=r" (ret));
419eecca32Smatt
429eecca32Smatt return ret;
439eecca32Smatt }
449eecca32Smatt
459eecca32Smatt #define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[_REG_SP])
469eecca32Smatt
479eecca32Smatt /*
489eecca32Smatt * Set initial, sane values for registers whose values aren't just
499eecca32Smatt * "don't care".
509eecca32Smatt * 0x03c00000 is PSL_U|PSL_PREVU from arch/vax/include/psl.h
519eecca32Smatt */
529eecca32Smatt #define _INITCONTEXT_U_MD(ucp) \
539eecca32Smatt (ucp)->uc_mcontext.__gregs[_REG_PSL] = 0x03c00000;
549eecca32Smatt
55a67e1e34Sad /* Don't need additional memory barriers. */
56a67e1e34Sad #define PTHREAD__ATOMIC_IS_MEMBAR
57a67e1e34Sad
589eecca32Smatt #endif /* _LIB_PTHREAD_VAX_MD_H */
59