xref: /titanic_41/usr/src/uts/sparc/v7/sys/machpcb.h (revision 70025d765b044c6d8594bb965a2247a61e991a99)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1990 by Sun Microsystems, Inc.
24  */
25 
26 #ifndef _SYS_MACHPCB_H
27 #define	_SYS_MACHPCB_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/stack.h>
32 #include <sys/regset.h>
33 #include <sys/privregs.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 /*
40  * This file is machine dependent.
41  */
42 
43 /*
44  * Machine dependent per-thread data.
45  */
46 #define	MAXWIN	8	/* max # of windows currently supported */
47 
48 /*
49  * The system actually supports one more than the above number.
50  * There is always one window reserved for trap handlers that
51  * never has to be saved into the pcb struct.
52  */
53 
54 /*
55  * Distance from beginning of thread stack (t_stk) to saved regs struct.
56  */
57 #define	REGOFF	MINFRAME
58 
59 #ifndef _ASM
60 
61 /*
62  * The struct machpcb is always allocated stack aligned.
63  */
64 typedef struct machpcb {
65 	char	mpcb_frame[REGOFF];
66 	struct	regs mpcb_regs;	/* user's saved registers */
67 	struct	rwindow mpcb_wbuf[MAXWIN]; /* user window save buffer */
68 	caddr_t	mpcb_spbuf[MAXWIN]; /* sp's for each wbuf */
69 	struct	rwindow mpcb_rwin[2]; /* windows used while doing watchpoints */
70 	caddr_t	mpcb_rsp[2];	/* sp's for pcb_rwin[]  */
71 	int	mpcb_uwm;	/* user window mask */
72 	int	mpcb_swm;	/* shared user/kernel window mask */
73 	int	mpcb_wbcnt;	/* number of saved windows in pcb_wbuf */
74 	struct	fpu mpcb_fpu;	/* fpu state */
75 	struct	fq mpcb_fpu_q[MAXFPQ]; /* fpu exception queue */
76 	int	mpcb_flags;	/* various state flags */
77 	int	mpcb_wocnt;	/* window overflow count */
78 	int	mpcb_wucnt;	/* window underflow count */
79 	kthread_t *mpcb_thread;	/* associated thread */
80 } machpcb_t;
81 #endif /* ! _ASM */
82 
83 /* mpcb_flags */
84 #define	CLEAN_WINDOWS	0x01	/* keep user regs clean */
85 #define	FP_TRAPPED	0x02	/* fp_traps call caused by fp queue */
86 #define	GOTO_SYS_RTT	0x04	/* return from syscall via sys_rtt */
87 
88 
89 /*
90  * We can use lwp_regs to find the mpcb base.
91  */
92 #ifndef _ASM
93 #define	lwptompcb(lwp)	((struct machpcb *) \
94 	    ((caddr_t)(lwp)->lwp_regs - REGOFF))
95 #endif
96 
97 #ifdef	__cplusplus
98 }
99 #endif
100 
101 #endif	/* _SYS_MACHPCB_H */
102