xref: /titanic_41/usr/src/lib/libbc/inc/include/sun4/trap.h (revision 5d54f3d8999eac1762fe0a8c7177d20f1f201fae)
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 1985 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _sparc_trap_h
28 #define	_sparc_trap_h
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Trap type values.
34  */
35 #define TT(X)			((X)<<4)
36 
37 /*
38  * The Coprocessor bit.
39  */
40 #define CP_BIT 0x20
41 
42 /*
43  * Hardware traps.
44  */
45 #define T_RESET			0x00
46 #define T_TEXT_FAULT		0x01
47 #define T_UNIMP_INSTR		0x02
48 #define T_PRIV_INSTR		0x03
49 #define T_FP_DISABLED		0x04
50 #define T_CP_DISABLED		(0x4 | CP_BIT)
51 #define T_WIN_OVERFLOW		0x05
52 #define T_WIN_UNDERFLOW		0x06
53 #define T_ALIGNMENT		0x07
54 #define T_FP_EXCEPTION		0x08
55 #define T_CP_EXCEPTION		(0x8 | CP_BIT)
56 #define T_DATA_FAULT		0x09
57 #define T_TAG_OVERFLOW		0x0A
58 #define	T_INT			0x10
59 #define	T_INT_LEVEL		0x0F
60 #define T_INT_LEVEL_1		0x11
61 #define T_INT_LEVEL_2		0x12
62 #define T_INT_LEVEL_3		0x13
63 #define T_INT_LEVEL_4		0x14
64 #define T_INT_LEVEL_5		0x15
65 #define T_INT_LEVEL_6		0x16
66 #define T_INT_LEVEL_7		0x17
67 #define T_INT_LEVEL_8		0x18
68 #define T_INT_LEVEL_9		0x19
69 #define T_INT_LEVEL_10		0x1A
70 #define T_INT_LEVEL_11		0x1B
71 #define T_INT_LEVEL_12		0x1C
72 #define T_INT_LEVEL_13		0x1D
73 #define T_INT_LEVEL_14		0x1E
74 #define T_INT_LEVEL_15		0x1F
75 
76 /*
77  * Software traps (ticc instructions).
78  */
79 #define ST_SYSCALL		0x00
80 #define ST_BREAKPOINT		0x01
81 #define ST_DIV0			0x02
82 #define ST_FLUSH_WINDOWS	0x03
83 #define ST_CLEAN_WINDOWS	0x04
84 #define ST_RANGE_CHECK		0x05
85 #define ST_FIX_ALIGN		0x06
86 #define ST_INT_OVERFLOW		0x07
87 
88 #define ST_GETCC		0x20
89 #define ST_SETCC		0x21
90 #define ST_MON_BREAKPOINT	0x7F
91 
92 /*
93  * Software trap vectors 16 - 31 are reserved for use by the user
94  * and will not be usurped by Sun.
95  */
96 
97 /*
98  * Software trap type values.
99  */
100 #define T_SOFTWARE_TRAP		0x80
101 #define T_ESOFTWARE_TRAP	0xFF
102 #define T_SYSCALL		(T_SOFTWARE_TRAP + ST_SYSCALL)
103 #define T_BREAKPOINT		(T_SOFTWARE_TRAP + ST_BREAKPOINT)
104 #define T_DIV0			(T_SOFTWARE_TRAP + ST_DIV0)
105 #define T_FLUSH_WINDOWS		(T_SOFTWARE_TRAP + ST_FLUSH_WINDOWS)
106 #define T_CLEAN_WINDOWS		(T_SOFTWARE_TRAP + ST_CLEAN_WINDOWS)
107 #define T_RANGE_CHECK		(T_SOFTWARE_TRAP + ST_RANGE_CHECK)
108 #define T_FIX_ALIGN		(T_SOFTWARE_TRAP + ST_FIX_ALIGN)
109 #define T_INT_OVERFLOW		(T_SOFTWARE_TRAP + ST_INT_OVERFLOW)
110 
111 #define T_GETCC			(T_SOFTWARE_TRAP + ST_GETCC)
112 #define T_SETCC			(T_SOFTWARE_TRAP + ST_SETCC)
113 
114 /*
115  * Pseudo traps.
116  */
117 #define T_INTERRUPT		0x100
118 #define T_SPURIOUS		(T_INTERRUPT | T_INT)
119 #define T_FAULT			0x200
120 #define T_AST			0x400
121 #define T_ZERO			0x00
122 
123 #endif /* !_sparc_trap_h */
124