xref: /titanic_51/usr/src/uts/intel/ia32/sys/trap.h (revision 7509ca605713ac7f244b0e812b1712dd25f04da1)
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 /*	Copyright (c) 1990, 1991 UNIX System Laboratories, Inc.	*/
22 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 /*
26  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
27  * Use is subject to license terms.
28  */
29 
30 #ifndef _IA32_SYS_TRAP_H
31 #define	_IA32_SYS_TRAP_H
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * Trap type values
39  */
40 
41 #define	T_ZERODIV	0x0	/* #de	divide by 0 error		*/
42 #define	T_SGLSTP	0x1	/* #db	single step			*/
43 #define	T_NMIFLT	0x2	/* 	NMI				*/
44 #define	T_BPTFLT	0x3	/* #bp	breakpoint fault, INT3 insn	*/
45 #define	T_OVFLW		0x4	/* #of	INTO overflow fault		*/
46 #define	T_BOUNDFLT	0x5	/* #br	BOUND insn fault		*/
47 #define	T_ILLINST	0x6	/* #ud	invalid opcode fault		*/
48 #define	T_NOEXTFLT	0x7	/* #nm	device not available: x87	*/
49 #define	T_DBLFLT	0x8	/* #df	double fault			*/
50 #define	T_EXTOVRFLT	0x9	/* 	[not generated: 386 only]	*/
51 #define	T_TSSFLT	0xa	/* #ts	invalid TSS fault		*/
52 #define	T_SEGFLT	0xb	/* #np	segment not present fault	*/
53 #define	T_STKFLT	0xc	/* #ss	stack fault			*/
54 #define	T_GPFLT		0xd	/* #gp	general protection fault	*/
55 #define	T_PGFLT		0xe	/* #pf	page fault			*/
56 #define	T_EXTERRFLT	0x10	/* #mf	x87 FPU error fault		*/
57 #define	T_ALIGNMENT	0x11	/* #ac	alignment check error		*/
58 #define	T_MCE		0x12	/* #mc	machine check exception		*/
59 #define	T_SIMDFPE	0x13	/* #xm	SSE/SSE exception		*/
60 #define	T_DBGENTR	0x14	/*	debugger entry 			*/
61 #define	T_ENDPERR	0x21	/*	emulated extension error flt	*/
62 #define	T_ENOEXTFLT	0x20	/*	emulated ext not present	*/
63 #define	T_FASTTRAP	0xd2	/*	fast system call		*/
64 #define	T_SYSCALLINT	0x91	/*	general system call		*/
65 #define	T_DTRACE_RET	0x92	/*	DTrace pid return		*/
66 #define	T_INT80		0x80	/*	int80 handler for linux emulation */
67 #define	T_SOFTINT	0x50fd	/*	pseudo softint trap type	*/
68 
69 /*
70  * Pseudo traps.
71  */
72 #define	T_INTERRUPT		0x100
73 #define	T_FAULT			0x200
74 #define	T_AST			0x400
75 #define	T_SYSCALL		0x180
76 
77 
78 /*
79  *  Values of error code on stack in case of page fault
80  */
81 
82 #define	PF_ERR_MASK	0x01	/* Mask for error bit */
83 #define	PF_ERR_PAGE	0x00	/* page not present */
84 #define	PF_ERR_PROT	0x01	/* protection error */
85 #define	PF_ERR_WRITE	0x02	/* fault caused by write (else read) */
86 #define	PF_ERR_USER	0x04	/* processor was in user mode */
87 				/*	(else supervisor) */
88 #define	PF_ERR_EXEC	0x10	/* attempt to execute a No eXec page (AMD) */
89 				/* or kernel tried to execute a user page  */
90 				/* (Intel SMEP) */
91 
92 /*
93  *  Definitions for fast system call subfunctions
94  */
95 #define	T_FNULL		0	/* Null trap for testing		*/
96 #define	T_FGETFP	1	/* Get emulated FP context		*/
97 #define	T_FSETFP	2	/* Set emulated FP context		*/
98 #define	T_GETHRTIME	3	/* Get high resolution time		*/
99 #define	T_GETHRVTIME	4	/* Get high resolution virtual time	*/
100 #define	T_GETHRESTIME	5	/* Get high resolution time		*/
101 #define	T_GETLGRP	6	/* Get home lgrpid			*/
102 
103 #define	T_LASTFAST	6	/* Last valid subfunction		*/
104 
105 #ifdef	__cplusplus
106 }
107 #endif
108 
109 #endif	/* _IA32_SYS_TRAP_H */
110