xref: /titanic_50/usr/src/uts/intel/ia32/sys/trap.h (revision 799823bbed51a695d01e13511bbb1369980bb714)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5f498645aSahl  * Common Development and Distribution License (the "License").
6f498645aSahl  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*	Copyright (c) 1990, 1991 UNIX System Laboratories, Inc.	*/
227c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T	*/
237c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate /*
2626896e4cSGuoli Shu  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
277c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifndef _IA32_SYS_TRAP_H
317c478bd9Sstevel@tonic-gate #define	_IA32_SYS_TRAP_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
347c478bd9Sstevel@tonic-gate extern "C" {
357c478bd9Sstevel@tonic-gate #endif
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate  * Trap type values
397c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #define	T_ZERODIV	0x0	/* #de	divide by 0 error		*/
427c478bd9Sstevel@tonic-gate #define	T_SGLSTP	0x1	/* #db	single step			*/
437c478bd9Sstevel@tonic-gate #define	T_NMIFLT	0x2	/* 	NMI				*/
447c478bd9Sstevel@tonic-gate #define	T_BPTFLT	0x3	/* #bp	breakpoint fault, INT3 insn	*/
457c478bd9Sstevel@tonic-gate #define	T_OVFLW		0x4	/* #of	INTO overflow fault		*/
467c478bd9Sstevel@tonic-gate #define	T_BOUNDFLT	0x5	/* #br	BOUND insn fault		*/
477c478bd9Sstevel@tonic-gate #define	T_ILLINST	0x6	/* #ud	invalid opcode fault		*/
487c478bd9Sstevel@tonic-gate #define	T_NOEXTFLT	0x7	/* #nm	device not available: x87	*/
497c478bd9Sstevel@tonic-gate #define	T_DBLFLT	0x8	/* #df	double fault			*/
507c478bd9Sstevel@tonic-gate #define	T_EXTOVRFLT	0x9	/* 	[not generated: 386 only]	*/
517c478bd9Sstevel@tonic-gate #define	T_TSSFLT	0xa	/* #ts	invalid TSS fault		*/
527c478bd9Sstevel@tonic-gate #define	T_SEGFLT	0xb	/* #np	segment not present fault	*/
537c478bd9Sstevel@tonic-gate #define	T_STKFLT	0xc	/* #ss	stack fault			*/
547c478bd9Sstevel@tonic-gate #define	T_GPFLT		0xd	/* #gp	general protection fault	*/
557c478bd9Sstevel@tonic-gate #define	T_PGFLT		0xe	/* #pf	page fault			*/
567c478bd9Sstevel@tonic-gate #define	T_EXTERRFLT	0x10	/* #mf	x87 FPU error fault		*/
577c478bd9Sstevel@tonic-gate #define	T_ALIGNMENT	0x11	/* #ac	alignment check error		*/
587aec1d6eScindi #define	T_MCE		0x12	/* #mc	machine check exception		*/
597c478bd9Sstevel@tonic-gate #define	T_SIMDFPE	0x13	/* #xm	SSE/SSE exception		*/
607c478bd9Sstevel@tonic-gate #define	T_DBGENTR	0x14	/*	debugger entry 			*/
617c478bd9Sstevel@tonic-gate #define	T_ENDPERR	0x21	/*	emulated extension error flt	*/
627c478bd9Sstevel@tonic-gate #define	T_ENOEXTFLT	0x20	/*	emulated ext not present	*/
637c478bd9Sstevel@tonic-gate #define	T_FASTTRAP	0xd2	/*	fast system call		*/
647c478bd9Sstevel@tonic-gate #define	T_SYSCALLINT	0x91	/*	general system call		*/
6526896e4cSGuoli Shu #define	T_DTRACE_RET	0x92	/*	DTrace pid return		*/
669acbbeafSnn35248 #define	T_INT80		0x80	/*	int80 handler for linux emulation */
677c478bd9Sstevel@tonic-gate #define	T_SOFTINT	0x50fd	/*	pseudo softint trap type	*/
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate /*
707c478bd9Sstevel@tonic-gate  * Pseudo traps.
717c478bd9Sstevel@tonic-gate  */
727c478bd9Sstevel@tonic-gate #define	T_INTERRUPT		0x100
737c478bd9Sstevel@tonic-gate #define	T_FAULT			0x200
747c478bd9Sstevel@tonic-gate #define	T_AST			0x400
757c478bd9Sstevel@tonic-gate #define	T_SYSCALL		0x180
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate /*
797c478bd9Sstevel@tonic-gate  *  Values of error code on stack in case of page fault
807c478bd9Sstevel@tonic-gate  */
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate #define	PF_ERR_MASK	0x01	/* Mask for error bit */
837c478bd9Sstevel@tonic-gate #define	PF_ERR_PAGE	0x00	/* page not present */
847c478bd9Sstevel@tonic-gate #define	PF_ERR_PROT	0x01	/* protection error */
857c478bd9Sstevel@tonic-gate #define	PF_ERR_WRITE	0x02	/* fault caused by write (else read) */
867c478bd9Sstevel@tonic-gate #define	PF_ERR_USER	0x04	/* processor was in user mode */
877c478bd9Sstevel@tonic-gate 				/*	(else supervisor) */
887c478bd9Sstevel@tonic-gate #define	PF_ERR_EXEC	0x10	/* attempt to execute a No eXec page (AMD) */
89*799823bbSRobert Mustacchi 				/* or kernel tried to execute a user page  */
90*799823bbSRobert Mustacchi 				/* (Intel SMEP) */
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate /*
937c478bd9Sstevel@tonic-gate  *  Definitions for fast system call subfunctions
947c478bd9Sstevel@tonic-gate  */
957c478bd9Sstevel@tonic-gate #define	T_FNULL		0	/* Null trap for testing		*/
967c478bd9Sstevel@tonic-gate #define	T_FGETFP	1	/* Get emulated FP context		*/
977c478bd9Sstevel@tonic-gate #define	T_FSETFP	2	/* Set emulated FP context		*/
987c478bd9Sstevel@tonic-gate #define	T_GETHRTIME	3	/* Get high resolution time		*/
997c478bd9Sstevel@tonic-gate #define	T_GETHRVTIME	4	/* Get high resolution virtual time	*/
1007c478bd9Sstevel@tonic-gate #define	T_GETHRESTIME	5	/* Get high resolution time		*/
1017c478bd9Sstevel@tonic-gate #define	T_GETLGRP	6	/* Get home lgrpid			*/
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate #define	T_LASTFAST	6	/* Last valid subfunction		*/
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1067c478bd9Sstevel@tonic-gate }
1077c478bd9Sstevel@tonic-gate #endif
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate #endif	/* _IA32_SYS_TRAP_H */
110