xref: /illumos-gate/usr/src/lib/libfakekernel/common/sys/klwp.h (revision aeac2d873b68a43f6650e0d0f021c02f5a653a21)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 /*
26  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
27  */
28 
29 #ifndef	_SYS_KLWP_H
30 #define	_SYS_KLWP_H
31 
32 #include <sys/types.h>
33 #include <sys/condvar.h>
34 #include <sys/thread.h>
35 #include <sys/signal.h>
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 /*
42  * The light-weight process object and the methods by which it
43  * is accessed.
44  */
45 
46 #define	MAXSYSARGS	8	/* Maximum # of arguments passed to a syscall */
47 
48 /* lwp_eosys values */
49 #define	NORMALRETURN	0	/* normal return; adjusts PC, registers */
50 #define	JUSTRETURN	1	/* just return, leave registers alone */
51 
52 typedef struct _klwp	*klwp_id_t;
53 
54 typedef struct _klwp {
55 	/*
56 	 * linkage
57 	 */
58 	struct _kthread	*lwp_thread;
59 	struct proc	*lwp_procp;
60 
61 } klwp_t;
62 
63 /* lwp states */
64 #define	LWP_USER	0x01		/* Running in user mode */
65 #define	LWP_SYS		0x02		/* Running in kernel mode */
66 
67 #if	defined(_KERNEL)
68 extern	volatile int	lwp_default_stksize;
69 extern	klwp_t		lwp0;
70 
71 /* where newly-created lwps normally start */
72 extern	void	lwp_rtt(void);
73 
74 #endif	/* _KERNEL */
75 
76 #ifdef	__cplusplus
77 }
78 #endif
79 
80 #endif	/* _SYS_KLWP_H */
81