xref: /onnv-gate/usr/src/uts/intel/ia32/sys/trap.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*	Copyright (c) 1990, 1991 UNIX System Laboratories, Inc.	*/
23*0Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T	*/
24*0Sstevel@tonic-gate /*	  All Rights Reserved  	*/
25*0Sstevel@tonic-gate 
26*0Sstevel@tonic-gate /*
27*0Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
28*0Sstevel@tonic-gate  * Use is subject to license terms.
29*0Sstevel@tonic-gate  */
30*0Sstevel@tonic-gate 
31*0Sstevel@tonic-gate #ifndef _IA32_SYS_TRAP_H
32*0Sstevel@tonic-gate #define	_IA32_SYS_TRAP_H
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #ifdef	__cplusplus
37*0Sstevel@tonic-gate extern "C" {
38*0Sstevel@tonic-gate #endif
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate /*
41*0Sstevel@tonic-gate  * Trap type values
42*0Sstevel@tonic-gate  */
43*0Sstevel@tonic-gate 
44*0Sstevel@tonic-gate #define	T_ZERODIV	0x0	/* #de	divide by 0 error		*/
45*0Sstevel@tonic-gate #define	T_SGLSTP	0x1	/* #db	single step			*/
46*0Sstevel@tonic-gate #define	T_NMIFLT	0x2	/* 	NMI				*/
47*0Sstevel@tonic-gate #define	T_BPTFLT	0x3	/* #bp	breakpoint fault, INT3 insn	*/
48*0Sstevel@tonic-gate #define	T_OVFLW		0x4	/* #of	INTO overflow fault		*/
49*0Sstevel@tonic-gate #define	T_BOUNDFLT	0x5	/* #br	BOUND insn fault		*/
50*0Sstevel@tonic-gate #define	T_ILLINST	0x6	/* #ud	invalid opcode fault		*/
51*0Sstevel@tonic-gate #define	T_NOEXTFLT	0x7	/* #nm	device not available: x87	*/
52*0Sstevel@tonic-gate #define	T_DBLFLT	0x8	/* #df	double fault			*/
53*0Sstevel@tonic-gate #define	T_EXTOVRFLT	0x9	/* 	[not generated: 386 only]	*/
54*0Sstevel@tonic-gate #define	T_TSSFLT	0xa	/* #ts	invalid TSS fault		*/
55*0Sstevel@tonic-gate #define	T_SEGFLT	0xb	/* #np	segment not present fault	*/
56*0Sstevel@tonic-gate #define	T_STKFLT	0xc	/* #ss	stack fault			*/
57*0Sstevel@tonic-gate #define	T_GPFLT		0xd	/* #gp	general protection fault	*/
58*0Sstevel@tonic-gate #define	T_PGFLT		0xe	/* #pf	page fault			*/
59*0Sstevel@tonic-gate #define	T_EXTERRFLT	0x10	/* #mf	x87 FPU error fault		*/
60*0Sstevel@tonic-gate #define	T_ALIGNMENT	0x11	/* #ac	alignment check error		*/
61*0Sstevel@tonic-gate #define	T_MCE		0x12	/* #mc	machine check exception (P6 only) */
62*0Sstevel@tonic-gate #define	T_SIMDFPE	0x13	/* #xm	SSE/SSE exception		*/
63*0Sstevel@tonic-gate #define	T_DBGENTR	0x14	/*	debugger entry 			*/
64*0Sstevel@tonic-gate #define	T_ENDPERR	0x21	/*	emulated extension error flt	*/
65*0Sstevel@tonic-gate #define	T_ENOEXTFLT	0x20	/*	emulated ext not present	*/
66*0Sstevel@tonic-gate #define	T_FASTTRAP	0xd2	/*	fast system call		*/
67*0Sstevel@tonic-gate #define	T_SYSCALLINT	0x91	/*	general system call		*/
68*0Sstevel@tonic-gate #define	T_DTRACE_PROBE	0x7e	/*	DTrace fasttrap probe		*/
69*0Sstevel@tonic-gate #define	T_DTRACE_RET	0x7f	/*	DTrace pid return		*/
70*0Sstevel@tonic-gate #define	T_SOFTINT	0x50fd	/*	pseudo softint trap type	*/
71*0Sstevel@tonic-gate 
72*0Sstevel@tonic-gate /*
73*0Sstevel@tonic-gate  * Pseudo traps.
74*0Sstevel@tonic-gate  */
75*0Sstevel@tonic-gate #define	T_INTERRUPT		0x100
76*0Sstevel@tonic-gate #define	T_FAULT			0x200
77*0Sstevel@tonic-gate #define	T_AST			0x400
78*0Sstevel@tonic-gate #define	T_SYSCALL		0x180
79*0Sstevel@tonic-gate 
80*0Sstevel@tonic-gate 
81*0Sstevel@tonic-gate /*
82*0Sstevel@tonic-gate  *  Values of error code on stack in case of page fault
83*0Sstevel@tonic-gate  */
84*0Sstevel@tonic-gate 
85*0Sstevel@tonic-gate #define	PF_ERR_MASK	0x01	/* Mask for error bit */
86*0Sstevel@tonic-gate #define	PF_ERR_PAGE	0x00	/* page not present */
87*0Sstevel@tonic-gate #define	PF_ERR_PROT	0x01	/* protection error */
88*0Sstevel@tonic-gate #define	PF_ERR_WRITE	0x02	/* fault caused by write (else read) */
89*0Sstevel@tonic-gate #define	PF_ERR_USER	0x04	/* processor was in user mode */
90*0Sstevel@tonic-gate 				/*	(else supervisor) */
91*0Sstevel@tonic-gate #define	PF_ERR_EXEC	0x10	/* attempt to execute a No eXec page (AMD) */
92*0Sstevel@tonic-gate 
93*0Sstevel@tonic-gate /*
94*0Sstevel@tonic-gate  *  Definitions for fast system call subfunctions
95*0Sstevel@tonic-gate  */
96*0Sstevel@tonic-gate #define	T_FNULL		0	/* Null trap for testing		*/
97*0Sstevel@tonic-gate #define	T_FGETFP	1	/* Get emulated FP context		*/
98*0Sstevel@tonic-gate #define	T_FSETFP	2	/* Set emulated FP context		*/
99*0Sstevel@tonic-gate #define	T_GETHRTIME	3	/* Get high resolution time		*/
100*0Sstevel@tonic-gate #define	T_GETHRVTIME	4	/* Get high resolution virtual time	*/
101*0Sstevel@tonic-gate #define	T_GETHRESTIME	5	/* Get high resolution time		*/
102*0Sstevel@tonic-gate #define	T_GETLGRP	6	/* Get home lgrpid			*/
103*0Sstevel@tonic-gate 
104*0Sstevel@tonic-gate #define	T_LASTFAST	6	/* Last valid subfunction		*/
105*0Sstevel@tonic-gate 
106*0Sstevel@tonic-gate #ifdef	__cplusplus
107*0Sstevel@tonic-gate }
108*0Sstevel@tonic-gate #endif
109*0Sstevel@tonic-gate 
110*0Sstevel@tonic-gate #endif	/* _IA32_SYS_TRAP_H */
111