xref: /freebsd/sys/cddl/dev/dtrace/x86/regset.h (revision 29363fb4)
10339a1c2SMark Johnston /*
20339a1c2SMark Johnston  * CDDL HEADER START
30339a1c2SMark Johnston  *
40339a1c2SMark Johnston  * The contents of this file are subject to the terms of the
50339a1c2SMark Johnston  * Common Development and Distribution License, Version 1.0 only
60339a1c2SMark Johnston  * (the "License").  You may not use this file except in compliance
70339a1c2SMark Johnston  * with the License.
80339a1c2SMark Johnston  *
90339a1c2SMark Johnston  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100339a1c2SMark Johnston  * or http://www.opensolaris.org/os/licensing.
110339a1c2SMark Johnston  * See the License for the specific language governing permissions
120339a1c2SMark Johnston  * and limitations under the License.
130339a1c2SMark Johnston  *
140339a1c2SMark Johnston  * When distributing Covered Code, include this CDDL HEADER in each
150339a1c2SMark Johnston  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160339a1c2SMark Johnston  * If applicable, add the following below this CDDL HEADER, with the
170339a1c2SMark Johnston  * fields enclosed by brackets "[]" replaced with your own identifying
180339a1c2SMark Johnston  * information: Portions Copyright [yyyy] [name of copyright owner]
190339a1c2SMark Johnston  *
200339a1c2SMark Johnston  * CDDL HEADER END
210339a1c2SMark Johnston  *
220339a1c2SMark Johnston  */
230339a1c2SMark Johnston /*
240339a1c2SMark Johnston  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
250339a1c2SMark Johnston  * Use is subject to license terms.
260339a1c2SMark Johnston  */
270339a1c2SMark Johnston 
280339a1c2SMark Johnston /*	Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
290339a1c2SMark Johnston 
300339a1c2SMark Johnston /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T		*/
310339a1c2SMark Johnston /*	All Rights Reserved	*/
320339a1c2SMark Johnston 
330339a1c2SMark Johnston #ifndef	_REGSET_H
340339a1c2SMark Johnston #define	_REGSET_H
350339a1c2SMark Johnston 
360339a1c2SMark Johnston /*
370339a1c2SMark Johnston  */
380339a1c2SMark Johnston 
390339a1c2SMark Johnston #ifdef __cplusplus
400339a1c2SMark Johnston extern "C" {
410339a1c2SMark Johnston #endif
420339a1c2SMark Johnston 
430339a1c2SMark Johnston /*
440339a1c2SMark Johnston  * The names and offsets defined here should be specified by the
450339a1c2SMark Johnston  * AMD64 ABI suppl.
460339a1c2SMark Johnston  *
470339a1c2SMark Johnston  * We make fsbase and gsbase part of the lwp context (since they're
480339a1c2SMark Johnston  * the only way to access the full 64-bit address range via the segment
490339a1c2SMark Johnston  * registers) and thus belong here too.  However we treat them as
500339a1c2SMark Johnston  * read-only; if %fs or %gs are updated, the results of the descriptor
510339a1c2SMark Johnston  * table lookup that those updates implicitly cause will be reflected
520339a1c2SMark Johnston  * in the corresponding fsbase and/or gsbase values the next time the
530339a1c2SMark Johnston  * context can be inspected.  However it is NOT possible to override
540339a1c2SMark Johnston  * the fsbase/gsbase settings via this interface.
550339a1c2SMark Johnston  *
560339a1c2SMark Johnston  * Direct modification of the base registers (thus overriding the
570339a1c2SMark Johnston  * descriptor table base address) can be achieved with _lwp_setprivate.
580339a1c2SMark Johnston  */
590339a1c2SMark Johnston 
600339a1c2SMark Johnston #define	REG_GSBASE	27
610339a1c2SMark Johnston #define	REG_FSBASE	26
62c0c943deSMark Johnston #define	REG_SS		25
63c0c943deSMark Johnston #define	REG_RSP		24
64c0c943deSMark Johnston #define	REG_RFL		23
65c0c943deSMark Johnston #define	REG_CS		22
66c0c943deSMark Johnston #define	REG_RIP		21
67c0c943deSMark Johnston #define	REG_DS		20
68c0c943deSMark Johnston #define	REG_ES		19
69c0c943deSMark Johnston #define	REG_ERR		18
70c0c943deSMark Johnston #define	REG_GS		17
71c0c943deSMark Johnston #define	REG_FS		16
72c0c943deSMark Johnston #define	REG_TRAPNO	15
73c0c943deSMark Johnston #define	REG_RAX		14
74c0c943deSMark Johnston #define	REG_RCX		13
75c0c943deSMark Johnston #define	REG_RDX		12
76c0c943deSMark Johnston #define	REG_RBX		11
77c0c943deSMark Johnston #define	REG_RBP		10
78c0c943deSMark Johnston #define	REG_RSI		9
79c0c943deSMark Johnston #define	REG_RDI		8
80c0c943deSMark Johnston #define	REG_R8		7
81c0c943deSMark Johnston #define	REG_R9		6
82c0c943deSMark Johnston #define	REG_R10		5
83c0c943deSMark Johnston #define	REG_R11		4
84c0c943deSMark Johnston #define	REG_R12		3
85c0c943deSMark Johnston #define	REG_R13		2
86c0c943deSMark Johnston #define	REG_R14		1
87c0c943deSMark Johnston #define	REG_R15		0
880339a1c2SMark Johnston 
890339a1c2SMark Johnston /*
900339a1c2SMark Johnston  * The names and offsets defined here are specified by i386 ABI suppl.
910339a1c2SMark Johnston  */
920339a1c2SMark Johnston 
93c0c943deSMark Johnston #define	GS		18
94c0c943deSMark Johnston #define	SS		17	/* only stored on a privilege transition */
95c0c943deSMark Johnston #define	UESP		16	/* only stored on a privilege transition */
96c0c943deSMark Johnston #define	EFL		15
97c0c943deSMark Johnston #define	CS		14
98c0c943deSMark Johnston #define	EIP		13
99c0c943deSMark Johnston #define	ERR		12
100c0c943deSMark Johnston #define	TRAPNO		11
101c0c943deSMark Johnston #define	EAX		10
102c0c943deSMark Johnston #define	ECX		9
103c0c943deSMark Johnston #define	EDX		8
104c0c943deSMark Johnston #define	EBX		7
105c0c943deSMark Johnston #define	ESP		6
106c0c943deSMark Johnston #define	EBP		5
107c0c943deSMark Johnston #define	ESI		4
108c0c943deSMark Johnston #define	EDI		3
109c0c943deSMark Johnston #define	DS		2
110c0c943deSMark Johnston #define	ES		1
111c0c943deSMark Johnston #define	FS		0
1120339a1c2SMark Johnston 
1130339a1c2SMark Johnston #define REG_PC  EIP
1140339a1c2SMark Johnston #define REG_FP  EBP
1150339a1c2SMark Johnston #define REG_SP  UESP
1160339a1c2SMark Johnston #define REG_PS  EFL
1170339a1c2SMark Johnston #define REG_R0  EAX
1180339a1c2SMark Johnston #define REG_R1  EDX
1190339a1c2SMark Johnston 
1200339a1c2SMark Johnston #ifdef	__cplusplus
1210339a1c2SMark Johnston }
1220339a1c2SMark Johnston #endif
1230339a1c2SMark Johnston 
1240339a1c2SMark Johnston #endif	/* _REGSET_H */
125