12b616c6cSwesolows /* 22b616c6cSwesolows * CDDL HEADER START 32b616c6cSwesolows * 42b616c6cSwesolows * The contents of this file are subject to the terms of the 52b616c6cSwesolows * Common Development and Distribution License (the "License"). 62b616c6cSwesolows * You may not use this file except in compliance with the License. 72b616c6cSwesolows * 82b616c6cSwesolows * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 92b616c6cSwesolows * or http://www.opensolaris.org/os/licensing. 102b616c6cSwesolows * See the License for the specific language governing permissions 112b616c6cSwesolows * and limitations under the License. 122b616c6cSwesolows * 132b616c6cSwesolows * When distributing Covered Code, include this CDDL HEADER in each 142b616c6cSwesolows * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 152b616c6cSwesolows * If applicable, add the following below this CDDL HEADER, with the 162b616c6cSwesolows * fields enclosed by brackets "[]" replaced with your own identifying 172b616c6cSwesolows * information: Portions Copyright [yyyy] [name of copyright owner] 182b616c6cSwesolows * 192b616c6cSwesolows * CDDL HEADER END 202b616c6cSwesolows */ 212b616c6cSwesolows 222b616c6cSwesolows /* 232b616c6cSwesolows * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 242b616c6cSwesolows * Use is subject to license terms. 252b616c6cSwesolows */ 262b616c6cSwesolows 272b616c6cSwesolows #ifndef _ASM_THREAD_H 282b616c6cSwesolows #define _ASM_THREAD_H 292b616c6cSwesolows 30*6b7143d7SRichard Lowe #include <sys/ccompile.h> 312b616c6cSwesolows #include <sys/types.h> 322b616c6cSwesolows 332b616c6cSwesolows #ifdef __cplusplus 342b616c6cSwesolows extern "C" { 352b616c6cSwesolows #endif 362b616c6cSwesolows 372b616c6cSwesolows #if !defined(__lint) && defined(__GNUC__) 382b616c6cSwesolows 392b616c6cSwesolows struct _kthread; 402b616c6cSwesolows 41*6b7143d7SRichard Lowe extern __GNU_INLINE struct _kthread * 422b616c6cSwesolows threadp(void) 432b616c6cSwesolows { 442b616c6cSwesolows void *__value; 452b616c6cSwesolows 462b616c6cSwesolows #if defined(__sparcv9) 472b616c6cSwesolows __asm__ __volatile__( 482b616c6cSwesolows ".register %%g7, #scratch\n\t" 492b616c6cSwesolows "mov %%g7, %0" 502b616c6cSwesolows : "=r" (__value)); 512b616c6cSwesolows #else 522b616c6cSwesolows #error "port me" 532b616c6cSwesolows #endif 542b616c6cSwesolows return (__value); 552b616c6cSwesolows } 562b616c6cSwesolows 57*6b7143d7SRichard Lowe extern __GNU_INLINE caddr_t 582b616c6cSwesolows caller(void) 592b616c6cSwesolows { 602b616c6cSwesolows caddr_t __value; 612b616c6cSwesolows 622b616c6cSwesolows #if defined(__sparcv9) 632b616c6cSwesolows __asm__ __volatile__( 642b616c6cSwesolows "mov %%i7, %0" 652b616c6cSwesolows : "=r" (__value)); 662b616c6cSwesolows #else 672b616c6cSwesolows #error "port me" 682b616c6cSwesolows #endif 692b616c6cSwesolows return (__value); 702b616c6cSwesolows } 712b616c6cSwesolows 72*6b7143d7SRichard Lowe extern __GNU_INLINE caddr_t 732b616c6cSwesolows callee(void) 742b616c6cSwesolows { 752b616c6cSwesolows caddr_t __value; 762b616c6cSwesolows 772b616c6cSwesolows #if defined(__sparcv9) 782b616c6cSwesolows __asm__ __volatile__( 792b616c6cSwesolows "mov %%o7, %0" 802b616c6cSwesolows : "=r" (__value)); 812b616c6cSwesolows #else 822b616c6cSwesolows #error "port me" 832b616c6cSwesolows #endif 842b616c6cSwesolows return (__value); 852b616c6cSwesolows } 862b616c6cSwesolows 872b616c6cSwesolows #endif /* !__lint && __GNUC__ */ 882b616c6cSwesolows 892b616c6cSwesolows #ifdef __cplusplus 902b616c6cSwesolows } 912b616c6cSwesolows #endif 922b616c6cSwesolows 932b616c6cSwesolows #endif /* _ASM_THREAD_H */ 94