thread.h revision 6b7143d774683daf27dfb2e93ab48d1ade1a3477
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows/*
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows * CDDL HEADER START
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows *
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows * The contents of this file are subject to the terms of the
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows * Common Development and Distribution License (the "License").
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows * You may not use this file except in compliance with the License.
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows *
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows * or http://www.opensolaris.org/os/licensing.
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows * See the License for the specific language governing permissions
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows * and limitations under the License.
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows *
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows * When distributing Covered Code, include this CDDL HEADER in each
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows * If applicable, add the following below this CDDL HEADER, with the
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows * fields enclosed by brackets "[]" replaced with your own identifying
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows * information: Portions Copyright [yyyy] [name of copyright owner]
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows *
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows * CDDL HEADER END
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows */
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows/*
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows * Use is subject to license terms.
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows */
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#ifndef _ASM_THREAD_H
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#define _ASM_THREAD_H
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows
6b7143d774683daf27dfb2e93ab48d1ade1a3477Richard Lowe#include <sys/ccompile.h>
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#include <sys/types.h>
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#ifdef __cplusplus
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolowsextern "C" {
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#endif
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#if !defined(__lint) && defined(__GNUC__)
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolowsstruct _kthread;
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows
6b7143d774683daf27dfb2e93ab48d1ade1a3477Richard Loweextern __GNU_INLINE struct _kthread *
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolowsthreadp(void)
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows{
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows void *__value;
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#if defined(__sparcv9)
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows __asm__ __volatile__(
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows ".register %%g7, #scratch\n\t"
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows "mov %%g7, %0"
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows : "=r" (__value));
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#else
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#error "port me"
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#endif
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows return (__value);
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows}
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows
6b7143d774683daf27dfb2e93ab48d1ade1a3477Richard Loweextern __GNU_INLINE caddr_t
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolowscaller(void)
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows{
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows caddr_t __value;
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#if defined(__sparcv9)
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows __asm__ __volatile__(
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows "mov %%i7, %0"
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows : "=r" (__value));
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#else
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#error "port me"
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#endif
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows return (__value);
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows}
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows
6b7143d774683daf27dfb2e93ab48d1ade1a3477Richard Loweextern __GNU_INLINE caddr_t
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolowscallee(void)
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows{
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows caddr_t __value;
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#if defined(__sparcv9)
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows __asm__ __volatile__(
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows "mov %%o7, %0"
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows : "=r" (__value));
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#else
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#error "port me"
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#endif
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows return (__value);
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows}
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#endif /* !__lint && __GNUC__ */
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#ifdef __cplusplus
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows}
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#endif
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows
2b616c6c748ccca60ec7bdc3c781d84203c97b2bwesolows#endif /* _ASM_THREAD_H */