xref: /illumos-gate/usr/src/uts/sparc/v7/sys/machtrap.h (revision 0e42dee69ed771bf604dd1789fca9d77b5bbe302)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_MACHTRAP_H
28 #define	_SYS_MACHTRAP_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * This file is machine specific as is.
38  * Some trap types could be made common
39  * for all sparcs, but that is a project
40  * in and of itself.
41  */
42 
43 /*
44  * Trap type values.
45  */
46 #define	TT(X)			((X)<<4)
47 
48 /*
49  * The Coprocessor bit.
50  */
51 #define	CP_BIT 0x20
52 
53 /*
54  * Hardware traps.
55  */
56 #define	T_RESET			0x00
57 #define	T_TEXT_FAULT		0x01
58 #define	T_UNIMP_INSTR		0x02
59 #define	T_PRIV_INSTR		0x03
60 #define	T_FP_DISABLED		0x04
61 #define	T_CP_DISABLED		(0x4 | CP_BIT)
62 #define	T_WIN_OVERFLOW		0x05
63 #define	T_WIN_UNDERFLOW		0x06
64 #define	T_ALIGNMENT		0x07
65 #define	T_FP_EXCEPTION		0x08
66 #define	T_CP_EXCEPTION		(0x8 | CP_BIT)
67 #define	T_DATA_FAULT		0x09
68 #define	T_TAG_OVERFLOW		0x0A
69 #define	T_INT			0x10
70 #define	T_INT_LEVEL		0x0F
71 #define	T_INT_LEVEL_1		0x11
72 #define	T_INT_LEVEL_2		0x12
73 #define	T_INT_LEVEL_3		0x13
74 #define	T_INT_LEVEL_4		0x14
75 #define	T_INT_LEVEL_5		0x15
76 #define	T_INT_LEVEL_6		0x16
77 #define	T_INT_LEVEL_7		0x17
78 #define	T_INT_LEVEL_8		0x18
79 #define	T_INT_LEVEL_9		0x19
80 #define	T_INT_LEVEL_10		0x1A
81 #define	T_INT_LEVEL_11		0x1B
82 #define	T_INT_LEVEL_12		0x1C
83 #define	T_INT_LEVEL_13		0x1D
84 #define	T_INT_LEVEL_14		0x1E
85 #define	T_INT_LEVEL_15		0x1F
86 #define	T_TEXT_ERROR		0x21
87 #define	T_UNIMP_FLUSH		0x25	/* IFLUSH - unimplemented flush */
88 #define	T_DATA_ERROR		0x29
89 #define	T_IDIV0			0x2A
90 #define	T_DATA_STORE		0x2B
91 
92 /*
93  * Software trap type values.
94  */
95 #define	T_SOFTWARE_TRAP		0x80
96 #define	T_ESOFTWARE_TRAP	0xFF
97 #define	T_OSYSCALL		(T_SOFTWARE_TRAP + ST_OSYSCALL)
98 #define	T_BREAKPOINT		(T_SOFTWARE_TRAP + ST_BREAKPOINT)
99 #define	T_DIV0			(T_SOFTWARE_TRAP + ST_DIV0)
100 #define	T_FLUSH_WINDOWS		(T_SOFTWARE_TRAP + ST_FLUSH_WINDOWS)
101 #define	T_CLEAN_WINDOWS		(T_SOFTWARE_TRAP + ST_CLEAN_WINDOWS)
102 #define	T_RANGE_CHECK		(T_SOFTWARE_TRAP + ST_RANGE_CHECK)
103 #define	T_FIX_ALIGN		(T_SOFTWARE_TRAP + ST_FIX_ALIGN)
104 #define	T_INT_OVERFLOW		(T_SOFTWARE_TRAP + ST_INT_OVERFLOW)
105 #define	T_SYSCALL		(T_SOFTWARE_TRAP + ST_SYSCALL)
106 
107 #define	T_GETCC			(T_SOFTWARE_TRAP + ST_GETCC)
108 #define	T_SETCC			(T_SOFTWARE_TRAP + ST_SETCC)
109 
110 
111 /*
112  * Pseudo traps.
113  */
114 #define	T_INTERRUPT		0x100
115 #define	T_SPURIOUS		(T_INTERRUPT | T_INT)
116 #define	T_FAULT			0x200
117 #define	T_AST			0x400
118 #define	T_FLUSH_PCB		(T_AST + 0x10)
119 #define	T_SYS_RTT_PAGE		(T_AST + 0x20)
120 #define	T_ZERO			0x00
121 
122 #ifdef	__cplusplus
123 }
124 #endif
125 
126 #endif	/* _SYS_MACHTRAP_H */
127