xref: /titanic_51/usr/src/uts/sparc/v7/sys/machpcb.h (revision bc0e91320069f0bcaee43e80a7ea686d9efa2d08)
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 #include <sys/stack.h>
30 #include <sys/regset.h>
31 #include <sys/privregs.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * This file is machine dependent.
39  */
40 
41 /*
42  * Machine dependent per-thread data.
43  */
44 #define	MAXWIN	8	/* max # of windows currently supported */
45 
46 /*
47  * The system actually supports one more than the above number.
48  * There is always one window reserved for trap handlers that
49  * never has to be saved into the pcb struct.
50  */
51 
52 /*
53  * Distance from beginning of thread stack (t_stk) to saved regs struct.
54  */
55 #define	REGOFF	MINFRAME
56 
57 #ifndef _ASM
58 
59 /*
60  * The struct machpcb is always allocated stack aligned.
61  */
62 typedef struct machpcb {
63 	char	mpcb_frame[REGOFF];
64 	struct	regs mpcb_regs;	/* user's saved registers */
65 	struct	rwindow mpcb_wbuf[MAXWIN]; /* user window save buffer */
66 	caddr_t	mpcb_spbuf[MAXWIN]; /* sp's for each wbuf */
67 	struct	rwindow mpcb_rwin[2]; /* windows used while doing watchpoints */
68 	caddr_t	mpcb_rsp[2];	/* sp's for pcb_rwin[]  */
69 	int	mpcb_uwm;	/* user window mask */
70 	int	mpcb_swm;	/* shared user/kernel window mask */
71 	int	mpcb_wbcnt;	/* number of saved windows in pcb_wbuf */
72 	struct	_fpu mpcb_fpu;	/* fpu state */
73 	struct	_fq mpcb_fpu_q[_MAXFPQ]; /* fpu exception queue */
74 	int	mpcb_flags;	/* various state flags */
75 	int	mpcb_wocnt;	/* window overflow count */
76 	int	mpcb_wucnt;	/* window underflow count */
77 	kthread_t *mpcb_thread;	/* associated thread */
78 } machpcb_t;
79 #endif /* ! _ASM */
80 
81 /* mpcb_flags */
82 #define	CLEAN_WINDOWS	0x01	/* keep user regs clean */
83 #define	FP_TRAPPED	0x02	/* fp_traps call caused by fp queue */
84 #define	GOTO_SYS_RTT	0x04	/* return from syscall via sys_rtt */
85 
86 
87 /*
88  * We can use lwp_regs to find the mpcb base.
89  */
90 #ifndef _ASM
91 #define	lwptompcb(lwp)	((struct machpcb *) \
92 	    ((caddr_t)(lwp)->lwp_regs - REGOFF))
93 #endif
94 
95 #ifdef	__cplusplus
96 }
97 #endif
98 
99 #endif	/* _SYS_MACHPCB_H */
100