xref: /titanic_52/usr/src/uts/intel/ia32/sys/trap.h (revision 18c2aff776a775d34a4c9893a4c72e0434d68e36)
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 2006 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 /*
40  * Trap type values
41  */
42 
43 #define	T_ZERODIV	0x0	/* #de	divide by 0 error		*/
44 #define	T_SGLSTP	0x1	/* #db	single step			*/
45 #define	T_NMIFLT	0x2	/* 	NMI				*/
46 #define	T_BPTFLT	0x3	/* #bp	breakpoint fault, INT3 insn	*/
47 #define	T_OVFLW		0x4	/* #of	INTO overflow fault		*/
48 #define	T_BOUNDFLT	0x5	/* #br	BOUND insn fault		*/
49 #define	T_ILLINST	0x6	/* #ud	invalid opcode fault		*/
50 #define	T_NOEXTFLT	0x7	/* #nm	device not available: x87	*/
51 #define	T_DBLFLT	0x8	/* #df	double fault			*/
52 #define	T_EXTOVRFLT	0x9	/* 	[not generated: 386 only]	*/
53 #define	T_TSSFLT	0xa	/* #ts	invalid TSS fault		*/
54 #define	T_SEGFLT	0xb	/* #np	segment not present fault	*/
55 #define	T_STKFLT	0xc	/* #ss	stack fault			*/
56 #define	T_GPFLT		0xd	/* #gp	general protection fault	*/
57 #define	T_PGFLT		0xe	/* #pf	page fault			*/
58 #define	T_EXTERRFLT	0x10	/* #mf	x87 FPU error fault		*/
59 #define	T_ALIGNMENT	0x11	/* #ac	alignment check error		*/
60 #define	T_MCE		0x12	/* #mc	machine check exception		*/
61 #define	T_SIMDFPE	0x13	/* #xm	SSE/SSE exception		*/
62 #define	T_DBGENTR	0x14	/*	debugger entry 			*/
63 #define	T_ENDPERR	0x21	/*	emulated extension error flt	*/
64 #define	T_ENOEXTFLT	0x20	/*	emulated ext not present	*/
65 #define	T_FASTTRAP	0xd2	/*	fast system call		*/
66 #define	T_SYSCALLINT	0x91	/*	general system call		*/
67 #define	T_DTRACE_RET	0x7f	/*	DTrace pid return		*/
68 #define	T_INT80		0x80	/*	int80 handler for linux emulation */
69 #define	T_SOFTINT	0x50fd	/*	pseudo softint trap type	*/
70 
71 /*
72  * Pseudo traps.
73  */
74 #define	T_INTERRUPT		0x100
75 #define	T_FAULT			0x200
76 #define	T_AST			0x400
77 #define	T_SYSCALL		0x180
78 
79 
80 /*
81  *  Values of error code on stack in case of page fault
82  */
83 
84 #define	PF_ERR_MASK	0x01	/* Mask for error bit */
85 #define	PF_ERR_PAGE	0x00	/* page not present */
86 #define	PF_ERR_PROT	0x01	/* protection error */
87 #define	PF_ERR_WRITE	0x02	/* fault caused by write (else read) */
88 #define	PF_ERR_USER	0x04	/* processor was in user mode */
89 				/*	(else supervisor) */
90 #define	PF_ERR_EXEC	0x10	/* attempt to execute a No eXec page (AMD) */
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