xref: /titanic_50/usr/src/uts/intel/sys/pcb.h (revision 0ea5e3a571e3da934507bdd32924d11659c70704)
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 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_PCB_H
28 #define	_SYS_PCB_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/regset.h>
33 #include <sys/segments.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #ifndef _ASM
40 typedef struct fpu_ctx {
41 	kfpu_t		fpu_regs;	/* kernel save area for FPU */
42 	uint_t		fpu_flags;	/* FPU state flags */
43 } fpu_ctx_t;
44 
45 typedef struct pcb {
46 	fpu_ctx_t	pcb_fpu;	/* fpu state */
47 	uint_t		pcb_flags;	/* state flags; cleared on fork */
48 	greg_t		pcb_drstat;	/* status debug register (%dr6) */
49 	unsigned char	pcb_instr;	/* /proc: instruction at stop */
50 #if defined(__amd64)
51 	uintptr_t	pcb_fsbase;
52 	uintptr_t	pcb_gsbase;
53 	selector_t	pcb_ds;
54 	selector_t	pcb_es;
55 	selector_t	pcb_fs;
56 	selector_t	pcb_gs;
57 #endif /* __amd64 */
58 	user_desc_t	pcb_fsdesc;	/* private per-lwp %fs descriptors */
59 	user_desc_t	pcb_gsdesc;	/* private per-lwp %gs descriptors */
60 } pcb_t;
61 
62 #endif /* ! _ASM */
63 
64 /* pcb_flags */
65 #define	DEBUG_PENDING	0x02	/* single-step of lcall for a sys call */
66 #define	INSTR_VALID	0x08	/* value in pcb_instr is valid (/proc) */
67 #define	NORMAL_STEP	0x10	/* normal debugger-requested single-step */
68 #define	WATCH_STEP	0x20	/* single-stepping in watchpoint emulation */
69 #define	CPC_OVERFLOW	0x40	/* performance counters overflowed */
70 #define	RUPDATE_PENDING	0x80	/* new register values in the pcb -> regs */
71 #define	REQUEST_STEP	0x100	/* request pending to single-step this lwp */
72 #define	REQUEST_NOSTEP	0x200	/* request pending to disable single-step */
73 
74 /* fpu_flags */
75 #define	FPU_EN		0x1	/* flag signifying fpu in use */
76 #define	FPU_VALID	0x2	/* fpu_regs has valid fpu state */
77 #define	FPU_MODIFIED	0x4	/* fpu_regs is modified (/proc) */
78 
79 #define	FPU_INVALID	0x0	/* fpu context is not in use */
80 
81 /* fpu_flags */
82 
83 #ifdef	__cplusplus
84 }
85 #endif
86 
87 #endif	/* _SYS_PCB_H */
88