xref: /onnv-gate/usr/src/uts/intel/ia32/sys/trap.h (revision 11641:d71a0c77a32e)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52179Sahl  * Common Development and Distribution License (the "License").
62179Sahl  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*	Copyright (c) 1990, 1991 UNIX System Laboratories, Inc.	*/
220Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T	*/
230Sstevel@tonic-gate /*	  All Rights Reserved  	*/
240Sstevel@tonic-gate 
250Sstevel@tonic-gate /*
26*11641SKerry.Shu@Sun.COM  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
270Sstevel@tonic-gate  * Use is subject to license terms.
280Sstevel@tonic-gate  */
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #ifndef _IA32_SYS_TRAP_H
310Sstevel@tonic-gate #define	_IA32_SYS_TRAP_H
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #ifdef	__cplusplus
340Sstevel@tonic-gate extern "C" {
350Sstevel@tonic-gate #endif
360Sstevel@tonic-gate 
370Sstevel@tonic-gate /*
380Sstevel@tonic-gate  * Trap type values
390Sstevel@tonic-gate  */
400Sstevel@tonic-gate 
410Sstevel@tonic-gate #define	T_ZERODIV	0x0	/* #de	divide by 0 error		*/
420Sstevel@tonic-gate #define	T_SGLSTP	0x1	/* #db	single step			*/
430Sstevel@tonic-gate #define	T_NMIFLT	0x2	/* 	NMI				*/
440Sstevel@tonic-gate #define	T_BPTFLT	0x3	/* #bp	breakpoint fault, INT3 insn	*/
450Sstevel@tonic-gate #define	T_OVFLW		0x4	/* #of	INTO overflow fault		*/
460Sstevel@tonic-gate #define	T_BOUNDFLT	0x5	/* #br	BOUND insn fault		*/
470Sstevel@tonic-gate #define	T_ILLINST	0x6	/* #ud	invalid opcode fault		*/
480Sstevel@tonic-gate #define	T_NOEXTFLT	0x7	/* #nm	device not available: x87	*/
490Sstevel@tonic-gate #define	T_DBLFLT	0x8	/* #df	double fault			*/
500Sstevel@tonic-gate #define	T_EXTOVRFLT	0x9	/* 	[not generated: 386 only]	*/
510Sstevel@tonic-gate #define	T_TSSFLT	0xa	/* #ts	invalid TSS fault		*/
520Sstevel@tonic-gate #define	T_SEGFLT	0xb	/* #np	segment not present fault	*/
530Sstevel@tonic-gate #define	T_STKFLT	0xc	/* #ss	stack fault			*/
540Sstevel@tonic-gate #define	T_GPFLT		0xd	/* #gp	general protection fault	*/
550Sstevel@tonic-gate #define	T_PGFLT		0xe	/* #pf	page fault			*/
560Sstevel@tonic-gate #define	T_EXTERRFLT	0x10	/* #mf	x87 FPU error fault		*/
570Sstevel@tonic-gate #define	T_ALIGNMENT	0x11	/* #ac	alignment check error		*/
581414Scindi #define	T_MCE		0x12	/* #mc	machine check exception		*/
590Sstevel@tonic-gate #define	T_SIMDFPE	0x13	/* #xm	SSE/SSE exception		*/
600Sstevel@tonic-gate #define	T_DBGENTR	0x14	/*	debugger entry 			*/
610Sstevel@tonic-gate #define	T_ENDPERR	0x21	/*	emulated extension error flt	*/
620Sstevel@tonic-gate #define	T_ENOEXTFLT	0x20	/*	emulated ext not present	*/
630Sstevel@tonic-gate #define	T_FASTTRAP	0xd2	/*	fast system call		*/
640Sstevel@tonic-gate #define	T_SYSCALLINT	0x91	/*	general system call		*/
65*11641SKerry.Shu@Sun.COM #define	T_DTRACE_RET	0x92	/*	DTrace pid return		*/
662712Snn35248 #define	T_INT80		0x80	/*	int80 handler for linux emulation */
670Sstevel@tonic-gate #define	T_SOFTINT	0x50fd	/*	pseudo softint trap type	*/
680Sstevel@tonic-gate 
690Sstevel@tonic-gate /*
700Sstevel@tonic-gate  * Pseudo traps.
710Sstevel@tonic-gate  */
720Sstevel@tonic-gate #define	T_INTERRUPT		0x100
730Sstevel@tonic-gate #define	T_FAULT			0x200
740Sstevel@tonic-gate #define	T_AST			0x400
750Sstevel@tonic-gate #define	T_SYSCALL		0x180
760Sstevel@tonic-gate 
770Sstevel@tonic-gate 
780Sstevel@tonic-gate /*
790Sstevel@tonic-gate  *  Values of error code on stack in case of page fault
800Sstevel@tonic-gate  */
810Sstevel@tonic-gate 
820Sstevel@tonic-gate #define	PF_ERR_MASK	0x01	/* Mask for error bit */
830Sstevel@tonic-gate #define	PF_ERR_PAGE	0x00	/* page not present */
840Sstevel@tonic-gate #define	PF_ERR_PROT	0x01	/* protection error */
850Sstevel@tonic-gate #define	PF_ERR_WRITE	0x02	/* fault caused by write (else read) */
860Sstevel@tonic-gate #define	PF_ERR_USER	0x04	/* processor was in user mode */
870Sstevel@tonic-gate 				/*	(else supervisor) */
880Sstevel@tonic-gate #define	PF_ERR_EXEC	0x10	/* attempt to execute a No eXec page (AMD) */
890Sstevel@tonic-gate 
900Sstevel@tonic-gate /*
910Sstevel@tonic-gate  *  Definitions for fast system call subfunctions
920Sstevel@tonic-gate  */
930Sstevel@tonic-gate #define	T_FNULL		0	/* Null trap for testing		*/
940Sstevel@tonic-gate #define	T_FGETFP	1	/* Get emulated FP context		*/
950Sstevel@tonic-gate #define	T_FSETFP	2	/* Set emulated FP context		*/
960Sstevel@tonic-gate #define	T_GETHRTIME	3	/* Get high resolution time		*/
970Sstevel@tonic-gate #define	T_GETHRVTIME	4	/* Get high resolution virtual time	*/
980Sstevel@tonic-gate #define	T_GETHRESTIME	5	/* Get high resolution time		*/
990Sstevel@tonic-gate #define	T_GETLGRP	6	/* Get home lgrpid			*/
1000Sstevel@tonic-gate 
1010Sstevel@tonic-gate #define	T_LASTFAST	6	/* Last valid subfunction		*/
1020Sstevel@tonic-gate 
1030Sstevel@tonic-gate #ifdef	__cplusplus
1040Sstevel@tonic-gate }
1050Sstevel@tonic-gate #endif
1060Sstevel@tonic-gate 
1070Sstevel@tonic-gate #endif	/* _IA32_SYS_TRAP_H */
108