xref: /titanic_51/usr/src/uts/intel/sys/procfs_isa.h (revision 8808ac5dae118369991f158b6ab736cb2691ecde)
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_PROCFS_ISA_H
28 #define	_SYS_PROCFS_ISA_H
29 
30 /*
31  * Instruction Set Architecture specific component of <sys/procfs.h>
32  * i386 version
33  */
34 
35 #include <sys/regset.h>
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 /*
42  * Possible values of pr_dmodel.
43  * This isn't isa-specific, but it needs to be defined here for other reasons.
44  */
45 #define	PR_MODEL_UNKNOWN 0
46 #define	PR_MODEL_ILP32	1	/* process data model is ILP32 */
47 #define	PR_MODEL_LP64	2	/* process data model is LP64 */
48 
49 /*
50  * To determine whether application is running native.
51  */
52 #if defined(_LP64)
53 #define	PR_MODEL_NATIVE	PR_MODEL_LP64
54 #elif defined(_ILP32)
55 #define	PR_MODEL_NATIVE	PR_MODEL_ILP32
56 #else
57 #error "No DATAMODEL_NATIVE specified"
58 #endif	/* _LP64 || _ILP32 */
59 
60 #if defined(__i386) || defined(__amd64)
61 /*
62  * Holds one i386 or amd64 instruction
63  */
64 typedef	uchar_t instr_t;
65 #endif
66 
67 #define	NPRGREG		_NGREG
68 #define	prgreg_t	greg_t
69 #define	prgregset_t	gregset_t
70 #define	prfpregset	_fpu
71 #define	prfpregset_t	fpregset_t
72 
73 #if defined(_SYSCALL32)
74 /*
75  * kernel view of the ia32 register set
76  */
77 typedef	uchar_t		instr32_t;
78 #if defined(__amd64)
79 #define	NPRGREG32	_NGREG32
80 #define	prgreg32_t	greg32_t
81 #define	prgregset32_t	gregset32_t
82 #define	prfpregset32	fpu32
83 #define	prfpregset32_t	fpregset32_t
84 #else
85 #define	NPRGREG32	_NGREG
86 #define	prgreg32_t	greg_t
87 #define	prgregset32_t	gregset_t
88 #define	prfpregset32	_fpu
89 #define	prfpregset32_t	fpregset_t
90 #endif
91 #endif	/* _SYSCALL32 */
92 
93 #if defined(__amd64)
94 /*
95  * The following defines are for portability (see <sys/regset.h>).
96  */
97 #define	R_PC	REG_RIP
98 #define	R_PS	REG_RFL
99 #define	R_SP	REG_RSP
100 #define	R_FP	REG_RBP
101 #define	R_R0	REG_RAX
102 #define	R_R1	REG_RDX
103 #elif defined(__i386)
104 /*
105  * The following defines are for portability (see <sys/regset.h>).
106  */
107 #define	R_PC	EIP
108 #define	R_PS	EFL
109 #define	R_SP	UESP
110 #define	R_FP	EBP
111 #define	R_R0	EAX
112 #define	R_R1	EDX
113 #endif
114 
115 #ifdef	__cplusplus
116 }
117 #endif
118 
119 #endif	/* _SYS_PROCFS_ISA_H */
120