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