xref: /titanic_41/usr/src/uts/intel/sys/pcb.h (revision 95efa359b507db290a2484b8f615822b1e06096f)
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 #ifndef _SYS_PCB_H
27 #define	_SYS_PCB_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/regset.h>
32 #include <sys/segments.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 #ifndef _ASM
39 typedef struct fpu_ctx {
40 	kfpu_t		fpu_regs;	/* kernel save area for FPU */
41 	uint_t		fpu_flags;	/* FPU state flags */
42 } fpu_ctx_t;
43 
44 typedef struct pcb {
45 	fpu_ctx_t	pcb_fpu;	/* fpu state */
46 	uint_t		pcb_flags;	/* state flags; cleared on fork */
47 	greg_t		pcb_drstat;	/* status debug register (%dr6) */
48 	unsigned char	pcb_instr;	/* /proc: instruction at stop */
49 #if defined(__amd64)
50 	unsigned char	pcb_rupdate;	/* new register values in pcb -> regs */
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	REQUEST_STEP	0x100	/* request pending to single-step this lwp */
71 #define	REQUEST_NOSTEP	0x200	/* request pending to disable single-step */
72 #define	ASYNC_HWERR	0x400	/* hardware error has corrupted context  */
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