xref: /titanic_50/usr/src/uts/sparc/v9/sys/machpcb.h (revision 25cf1a301a396c38e8adf52c15f537b80d2483f7)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_MACHPCB_H
28 #define	_SYS_MACHPCB_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/stack.h>
33 #include <sys/regset.h>
34 #include <v9/sys/privregs.h>
35 #if defined(__lint)
36 #include <sys/thread.h>
37 #endif /* __lint */
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 /*
44  * This file is machine dependent.
45  */
46 
47 /*
48  * Machine dependent per-thread data.
49  */
50 #define	MAXWIN	8	/* max # of windows currently supported */
51 
52 /*
53  * The system actually supports one more than the above number.
54  * There is always one window reserved for trap handlers that
55  * never has to be saved into the pcb struct.
56  */
57 
58 /*
59  * Distance from beginning of thread stack (t_stk) to saved regs struct.
60  */
61 #define	REGOFF	SA(MINFRAME)
62 
63 #ifndef _ASM
64 
65 /*
66  * The struct machpcb is always allocated stack aligned.
67  */
68 typedef struct machpcb {
69 	char	mpcb_frame[REGOFF];
70 	struct	regs mpcb_regs;	/* user's saved registers */
71 	caddr_t	mpcb_wbuf;	/* pointer to wbuf */
72 	caddr_t	mpcb_spbuf[MAXWIN]; /* sp's for each wbuf */
73 	struct	rwindow mpcb_rwin[2]; /* windows used while doing watchpoints */
74 	caddr_t	mpcb_rsp[2];	/* sp's for pcb_rwin[]  */
75 	int	mpcb_wbcnt;	/* number of saved windows in pcb_wbuf */
76 	uint_t	mpcb_wstate;	/* per-lwp %wstate */
77 	kfpu_t	*mpcb_fpu; /* fpu state */
78 	struct	fq mpcb_fpu_q[MAXFPQ]; /* fpu exception queue */
79 	caddr_t	mpcb_illexcaddr; /* address of last illegal instruction */
80 	uint_t	mpcb_illexcinsn; /* last illegal instruction */
81 	int	mpcb_flags;	/* various state flags */
82 	int	mpcb_wocnt;	/* window overflow count */
83 	int	mpcb_wucnt;	/* window underflow count */
84 	kthread_t *mpcb_thread;	/* associated thread */
85 	uint64_t mpcb_pa;	/* pcb physical */
86 	uint64_t mpcb_wbuf_pa;	/* pointer to wbuf - physical */
87 } machpcb_t;
88 #endif /* ! _ASM */
89 
90 /* mpcb_flags */
91 #define	FP_TRAPPED	0x04	/* fp_traps call caused by fp queue */
92 
93 /*
94  * We can use lwp_regs to find the mpcb base.
95  */
96 #ifndef _ASM
97 #define	lwptompcb(lwp)	((struct machpcb *) \
98 	    ((caddr_t)(lwp)->lwp_regs - REGOFF))
99 #endif
100 
101 #ifdef	__cplusplus
102 }
103 #endif
104 
105 #endif	/* _SYS_MACHPCB_H */
106