1*2b616c6cSwesolows /* 2*2b616c6cSwesolows * CDDL HEADER START 3*2b616c6cSwesolows * 4*2b616c6cSwesolows * The contents of this file are subject to the terms of the 5*2b616c6cSwesolows * Common Development and Distribution License (the "License"). 6*2b616c6cSwesolows * You may not use this file except in compliance with the License. 7*2b616c6cSwesolows * 8*2b616c6cSwesolows * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*2b616c6cSwesolows * or http://www.opensolaris.org/os/licensing. 10*2b616c6cSwesolows * See the License for the specific language governing permissions 11*2b616c6cSwesolows * and limitations under the License. 12*2b616c6cSwesolows * 13*2b616c6cSwesolows * When distributing Covered Code, include this CDDL HEADER in each 14*2b616c6cSwesolows * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*2b616c6cSwesolows * If applicable, add the following below this CDDL HEADER, with the 16*2b616c6cSwesolows * fields enclosed by brackets "[]" replaced with your own identifying 17*2b616c6cSwesolows * information: Portions Copyright [yyyy] [name of copyright owner] 18*2b616c6cSwesolows * 19*2b616c6cSwesolows * CDDL HEADER END 20*2b616c6cSwesolows */ 21*2b616c6cSwesolows 22*2b616c6cSwesolows /* 23*2b616c6cSwesolows * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*2b616c6cSwesolows * Use is subject to license terms. 25*2b616c6cSwesolows */ 26*2b616c6cSwesolows 27*2b616c6cSwesolows #ifndef _ASM_THREAD_H 28*2b616c6cSwesolows #define _ASM_THREAD_H 29*2b616c6cSwesolows 30*2b616c6cSwesolows #pragma ident "%Z%%M% %I% %E% SMI" 31*2b616c6cSwesolows 32*2b616c6cSwesolows #include <sys/types.h> 33*2b616c6cSwesolows 34*2b616c6cSwesolows #ifdef __cplusplus 35*2b616c6cSwesolows extern "C" { 36*2b616c6cSwesolows #endif 37*2b616c6cSwesolows 38*2b616c6cSwesolows #if !defined(__lint) && defined(__GNUC__) 39*2b616c6cSwesolows 40*2b616c6cSwesolows struct _kthread; 41*2b616c6cSwesolows 42*2b616c6cSwesolows extern __inline__ struct _kthread * 43*2b616c6cSwesolows threadp(void) 44*2b616c6cSwesolows { 45*2b616c6cSwesolows void *__value; 46*2b616c6cSwesolows 47*2b616c6cSwesolows #if defined(__sparcv9) 48*2b616c6cSwesolows __asm__ __volatile__( 49*2b616c6cSwesolows ".register %%g7, #scratch\n\t" 50*2b616c6cSwesolows "mov %%g7, %0" 51*2b616c6cSwesolows : "=r" (__value)); 52*2b616c6cSwesolows #else 53*2b616c6cSwesolows #error "port me" 54*2b616c6cSwesolows #endif 55*2b616c6cSwesolows return (__value); 56*2b616c6cSwesolows } 57*2b616c6cSwesolows 58*2b616c6cSwesolows extern __inline__ caddr_t 59*2b616c6cSwesolows caller(void) 60*2b616c6cSwesolows { 61*2b616c6cSwesolows caddr_t __value; 62*2b616c6cSwesolows 63*2b616c6cSwesolows #if defined(__sparcv9) 64*2b616c6cSwesolows __asm__ __volatile__( 65*2b616c6cSwesolows "mov %%i7, %0" 66*2b616c6cSwesolows : "=r" (__value)); 67*2b616c6cSwesolows #else 68*2b616c6cSwesolows #error "port me" 69*2b616c6cSwesolows #endif 70*2b616c6cSwesolows return (__value); 71*2b616c6cSwesolows } 72*2b616c6cSwesolows 73*2b616c6cSwesolows extern __inline__ caddr_t 74*2b616c6cSwesolows callee(void) 75*2b616c6cSwesolows { 76*2b616c6cSwesolows caddr_t __value; 77*2b616c6cSwesolows 78*2b616c6cSwesolows #if defined(__sparcv9) 79*2b616c6cSwesolows __asm__ __volatile__( 80*2b616c6cSwesolows "mov %%o7, %0" 81*2b616c6cSwesolows : "=r" (__value)); 82*2b616c6cSwesolows #else 83*2b616c6cSwesolows #error "port me" 84*2b616c6cSwesolows #endif 85*2b616c6cSwesolows return (__value); 86*2b616c6cSwesolows } 87*2b616c6cSwesolows 88*2b616c6cSwesolows #endif /* !__lint && __GNUC__ */ 89*2b616c6cSwesolows 90*2b616c6cSwesolows #ifdef __cplusplus 91*2b616c6cSwesolows } 92*2b616c6cSwesolows #endif 93*2b616c6cSwesolows 94*2b616c6cSwesolows #endif /* _ASM_THREAD_H */ 95