]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - sys/sun4v/include/trap.h
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / sys / sun4v / include / trap.h
1 /*-
2  * Copyright (c) 2001 Jake Burkholder.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28
29 #ifndef _MACHINE_TRAP_H_
30 #define _MACHINE_TRAP_H_
31
32 #ifdef _KERNEL
33
34 #define T_RESERVED                      0
35 #define T_INSTRUCTION_EXCEPTION         1
36 #define T_INSTRUCTION_ERROR             2
37 #define T_INSTRUCTION_PROTECTION        3
38 #define T_ILLTRAP_INSTRUCTION           4
39 #define T_ILLEGAL_INSTRUCTION           5
40 #define T_PRIVILEGED_OPCODE             6
41 #define T_FP_DISABLED                   7
42 #define T_FP_EXCEPTION_IEEE_754         8
43 #define T_FP_EXCEPTION_OTHER            9
44 #define T_TAG_OVERFLOW                  10
45 #define T_DIVISION_BY_ZERO              11
46 #define T_DATA_EXCEPTION                12
47 #define T_DATA_ERROR                    13
48 #define T_DATA_PROTECTION               14
49 #define T_MEM_ADDRESS_NOT_ALIGNED       15
50 #define T_ALIGNMENT                     15
51 #define T_PRIVILEGED_ACTION             16
52 #define T_ASYNC_DATA_ERROR              17
53 #define T_TRAP_INSTRUCTION_16           18
54 #define T_TRAP_INSTRUCTION_17           19
55 #define T_TRAP_INSTRUCTION_18           20
56 #define T_TRAP_INSTRUCTION_19           21
57 #define T_TRAP_INSTRUCTION_20           22
58 #define T_TRAP_INSTRUCTION_21           23
59 #define T_TRAP_INSTRUCTION_22           24
60 #define T_TRAP_INSTRUCTION_23           25
61 #define T_TRAP_INSTRUCTION_24           26
62 #define T_TRAP_INSTRUCTION_25           27
63 #define T_TRAP_INSTRUCTION_26           28
64 #define T_TRAP_INSTRUCTION_27           29
65 #define T_TRAP_INSTRUCTION_28           30
66 #define T_TRAP_INSTRUCTION_29           31
67 #define T_TRAP_INSTRUCTION_30           32
68 #define T_TRAP_INSTRUCTION_31           33
69 #define T_INSTRUCTION_MISS              34
70 #define T_DATA_MISS                     35
71
72 #define T_INTERRUPT                     36
73 #define T_PA_WATCHPOINT                 37
74 #define T_VA_WATCHPOINT                 38
75 #define T_CORRECTED_ECC_ERROR           39
76 #define T_SPILL                         40
77 #define T_FILL                          41
78 #define T_FILL_RET                      42
79 #define T_BREAKPOINT                    43
80 #define T_CLEAN_WINDOW                  44
81 #define T_RANGE_CHECK                   45
82 #define T_FIX_ALIGNMENT                 46
83 #define T_INTEGER_OVERFLOW              47
84 #define T_SYSCALL                       48
85 #define T_RSTRWP_PHYS                   49
86 #define T_RSTRWP_VIRT                   50
87 #define T_KSTACK_FAULT                  51
88 #define T_RESUMABLE_ERROR               52
89 #define T_NONRESUMABLE_ERROR            53
90
91 #define T_MAX                           (T_NONRESUMABLE_ERROR + 1)
92
93 #define T_KERNEL                        64
94
95 #define TRAP_MASK                       ((1<<6)-1)
96 #define TRAP_CTX_SHIFT                  8
97 /*
98  * These defines are used by the TL1 tlb miss handlers to calculate
99  * the pc to jump to in the case the entry was not found in the TSB.
100  */
101
102 #define WTRAP_ALIGN     0x7f    /* window handlers are 128 byte align */
103 #define WTRAP_FAULTOFF  124     /* last instruction in handler */
104  
105 /* use the following defines to determine if trap was a fill or a spill */
106 #define WTRAP_TTMASK    0x180
107 #define WTRAP_TYPE      0x080
108
109 #define TT_INSTRUCTION_EXCEPTION        0x8
110 #define TT_INSTRUCTION_MISS             0x9
111 #define TT_ILLEGAL_INSTRUCTION          0x10
112 #define TT_PRIVILEGED_OPCODE            0x11
113 #define TT_FP_EXCEPTION_IEEE_754        0x21
114 #define TT_FP_EXCEPTION_OTHER           0x22
115 #define TT_TAG_OVERFLOW                 0x23
116 #define TT_DIVISION_BY_ZERO             0x28
117 #define TT_DATA_EXCEPTION               0x30
118 #define TT_DATA_MISS                    0x31
119 #define TT_ALIGNNMENT                   0x34
120 #define TT_DATA_PROTECTION              0x6c
121 #define TT_ALIGNMENT                    0x6c
122 #define TT_BREAKPOINT                   0x76
123
124 #define PTL1_BAD_DEBUG          0
125 #define PTL1_BAD_WTRAP          1
126 #define PTL1_BAD_KMISS          2
127 #define PTL1_BAD_KPROT_FAULT    3
128 #define PTL1_BAD_ISM            4
129 #define PTL1_BAD_MMUTRAP        5
130 #define PTL1_BAD_TRAP           6
131 #define PTL1_BAD_NOT_WTRAP      7
132 #if 0
133 #define PTL1_BAD_FPTRAP         7
134 #endif
135 #define PTL1_BAD_INTR_REQ       8
136 #define PTL1_BAD_TRACE_PTR      9
137
138 #define PTL1_BAD_STACK          10
139 #define PTL1_BAD_DTRACE_FLAGS   11
140 #define PTL1_BAD_CTX_STEAL      12
141 #define PTL1_BAD_ECC            13
142 #define PTL1_BAD_HCALL          14
143 #define PTL1_BAD_GL             15
144
145
146 #ifndef LOCORE
147 extern const char *const trap_msg[];
148 extern void set_mmfsa_traptable(void *, uint64_t);
149 extern void trap_init(void);
150 #endif
151
152 #endif
153
154 #endif /* !_MACHINE_TRAP_H_ */