gem5
v25.0.0.1
Loading...
Searching...
No Matches
arch
riscv
fault_codes.hh
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2024 National and Kapodistrian University of Athens
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 are
7
* met: redistributions of source code must retain the above copyright
8
* notice, this list of conditions and the following disclaimer;
9
* redistributions in binary form must reproduce the above copyright
10
* notice, this list of conditions and the following disclaimer in the
11
* documentation and/or other materials provided with the distribution;
12
* neither the name of the copyright holders nor the names of its
13
* contributors may be used to endorse or promote products derived from
14
* this software without specific prior written permission.
15
*
16
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
*/
28
29
#ifndef __ARCH_RISCV_FAULT_CODES_HH__
30
#define __ARCH_RISCV_FAULT_CODES_HH__
31
32
#include "
base/types.hh
"
33
34
namespace
gem5
35
{
36
37
namespace
RiscvISA
38
{
39
40
41
42
enum
FloatException
: uint64_t
43
{
44
FloatInexact
= 0x1,
45
FloatUnderflow
= 0x2,
46
FloatOverflow
= 0x4,
47
FloatDivZero
= 0x8,
48
FloatInvalid
= 0x10
49
};
50
51
/*
52
* In RISC-V, exception and interrupt codes share some values. They can be
53
* differentiated by an 'Interrupt' flag that is enabled for interrupt faults
54
* but not exceptions. The full fault cause can be computed by placing the
55
* exception (or interrupt) code in the least significant bits of the CAUSE
56
* CSR and then setting the highest bit of CAUSE with the 'Interrupt' flag.
57
* For more details on exception causes, see Chapter 3.1.20 of the RISC-V
58
* privileged specification v 1.10. Codes are enumerated in Table 3.6.
59
*/
60
enum
ExceptionCode
: uint64_t
61
{
62
INST_ADDR_MISALIGNED
= 0,
63
INST_ACCESS
= 1,
64
INST_ILLEGAL
= 2,
65
BREAKPOINT
= 3,
66
LOAD_ADDR_MISALIGNED
= 4,
67
LOAD_ACCESS
= 5,
68
STORE_ADDR_MISALIGNED
= 6,
69
AMO_ADDR_MISALIGNED
= 6,
70
STORE_ACCESS
= 7,
71
AMO_ACCESS
= 7,
72
ECALL_USER
= 8,
73
ECALL_SUPER
= 9,
74
ECALL_VIRTUAL_SUPER
= 10,
// H-extension
75
ECALL_MACHINE
= 11,
76
INST_PAGE
= 12,
77
LOAD_PAGE
= 13,
78
STORE_PAGE
= 15,
79
AMO_PAGE
= 15,
80
INST_GUEST_PAGE
= 20,
// H-extension
81
LOAD_GUEST_PAGE
= 21,
// H-extension
82
VIRTUAL_INST
= 22,
// H-extension
83
STORE_GUEST_PAGE
= 23,
// H-extension
84
AMO_GUEST_PAGE
= 23,
// H-extension
85
86
INT_SOFTWARE_SUPER
= 1,
87
INT_SOFTWARE_VIRTUAL_SUPER
= 2,
// H-extension
88
INT_SOFTWARE_MACHINE
= 3,
89
INT_TIMER_SUPER
= 5,
90
INT_TIMER_VIRTUAL_SUPER
= 6,
// H-extension
91
INT_TIMER_MACHINE
= 7,
92
INT_EXT_SUPER
= 9,
93
INT_EXT_VIRTUAL_SUPER
= 10,
// H-extension
94
INT_EXT_MACHINE
= 11,
95
INT_EXT_SUPER_GUEST
= 12,
// H-extension
96
INT_LOCAL_0
= 16,
97
INT_LOCAL_1
= 17,
98
INT_LOCAL_2
= 18,
99
INT_LOCAL_3
= 19,
100
INT_LOCAL_4
= 20,
101
INT_LOCAL_5
= 21,
102
INT_LOCAL_6
= 22,
103
INT_LOCAL_7
= 23,
104
INT_LOCAL_8
= 24,
105
INT_LOCAL_9
= 25,
106
INT_LOCAL_10
= 26,
107
INT_LOCAL_11
= 27,
108
INT_LOCAL_12
= 28,
109
INT_LOCAL_13
= 29,
110
INT_LOCAL_14
= 30,
111
INT_LOCAL_15
= 31,
112
INT_LOCAL_16
= 32,
113
INT_LOCAL_17
= 33,
114
INT_LOCAL_18
= 34,
115
INT_LOCAL_19
= 35,
116
INT_LOCAL_20
= 36,
117
INT_LOCAL_21
= 37,
118
INT_LOCAL_22
= 38,
119
INT_LOCAL_23
= 39,
120
INT_LOCAL_24
= 40,
121
INT_LOCAL_25
= 41,
122
INT_LOCAL_26
= 42,
123
INT_LOCAL_27
= 43,
124
INT_LOCAL_28
= 44,
125
INT_LOCAL_29
= 45,
126
INT_LOCAL_30
= 46,
127
INT_LOCAL_31
= 47,
128
INT_LOCAL_32
= 48,
129
INT_LOCAL_33
= 49,
130
INT_LOCAL_34
= 50,
131
INT_LOCAL_35
= 51,
132
INT_LOCAL_36
= 52,
133
INT_LOCAL_37
= 53,
134
INT_LOCAL_38
= 54,
135
INT_LOCAL_39
= 55,
136
INT_LOCAL_40
= 56,
137
INT_LOCAL_41
= 57,
138
INT_LOCAL_42
= 58,
139
INT_LOCAL_43
= 59,
140
INT_LOCAL_44
= 60,
141
INT_LOCAL_45
= 61,
142
INT_LOCAL_46
= 62,
143
INT_LOCAL_47
= 63,
144
NumInterruptTypes
,
145
// INT_NMI does not exist in the spec, it's a modeling artifact for NMI. We
146
// intentionally set it to be NumInterruptTypes so it can never conflict
147
// with any real INT_NUM in used.
148
INT_NMI
=
NumInterruptTypes
,
149
};
150
151
152
153
// H-extension useful masks
154
const
RegVal
DELEGABLE_EXCPS
= 0
155
| (1ULL <<
INST_ADDR_MISALIGNED
)
156
| (1ULL <<
INST_ACCESS
)
157
| (1ULL <<
INST_ILLEGAL
)
158
| (1ULL <<
BREAKPOINT
)
159
| (1ULL <<
LOAD_ADDR_MISALIGNED
)
160
| (1ULL <<
LOAD_ACCESS
)
161
| (1ULL <<
STORE_ADDR_MISALIGNED
)
162
| (1ULL <<
STORE_ACCESS
)
163
| (1ULL <<
ECALL_USER
)
164
| (1ULL <<
ECALL_SUPER
)
165
| (1ULL <<
ECALL_MACHINE
)
166
| (1ULL <<
INST_PAGE
)
167
| (1ULL <<
LOAD_PAGE
)
168
| (1ULL <<
STORE_PAGE
)
169
;
170
171
172
173
const
RegVal
DELEGABLE_EXCPS_WITH_RVH
=
DELEGABLE_EXCPS
174
| (1ULL <<
ECALL_VIRTUAL_SUPER
)
175
| (1ULL <<
INST_GUEST_PAGE
)
176
| (1ULL <<
LOAD_GUEST_PAGE
)
177
| (1ULL <<
VIRTUAL_INST
)
178
| (1ULL <<
STORE_GUEST_PAGE
)
179
;
180
181
const
RegVal
VS_DELEGABLE_EXCPS
=
DELEGABLE_EXCPS
&
182
~((1ULL <<
ECALL_SUPER
) |
183
(1ULL <<
ECALL_VIRTUAL_SUPER
) |
184
(1ULL <<
ECALL_MACHINE
) |
185
(1ULL <<
INST_GUEST_PAGE
) |
186
(1ULL <<
LOAD_GUEST_PAGE
) |
187
(1ULL <<
VIRTUAL_INST
) |
188
(1ULL <<
STORE_GUEST_PAGE
));
189
190
191
}
// namespace RiscvISA
192
}
// namespace gem5
193
194
#endif
// __ARCH_RISCV_FAULT_CODES_HH__
types.hh
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
gem5::RiscvISA
Definition
fs_workload.cc:41
gem5::RiscvISA::VS_DELEGABLE_EXCPS
const RegVal VS_DELEGABLE_EXCPS
Definition
fault_codes.hh:181
gem5::RiscvISA::DELEGABLE_EXCPS
const RegVal DELEGABLE_EXCPS
Definition
fault_codes.hh:154
gem5::RiscvISA::FloatException
FloatException
Definition
fault_codes.hh:43
gem5::RiscvISA::FloatUnderflow
@ FloatUnderflow
Definition
fault_codes.hh:45
gem5::RiscvISA::FloatDivZero
@ FloatDivZero
Definition
fault_codes.hh:47
gem5::RiscvISA::FloatInexact
@ FloatInexact
Definition
fault_codes.hh:44
gem5::RiscvISA::FloatInvalid
@ FloatInvalid
Definition
fault_codes.hh:48
gem5::RiscvISA::FloatOverflow
@ FloatOverflow
Definition
fault_codes.hh:46
gem5::RiscvISA::ExceptionCode
ExceptionCode
Definition
fault_codes.hh:61
gem5::RiscvISA::INT_LOCAL_28
@ INT_LOCAL_28
Definition
fault_codes.hh:124
gem5::RiscvISA::INT_LOCAL_42
@ INT_LOCAL_42
Definition
fault_codes.hh:138
gem5::RiscvISA::STORE_ADDR_MISALIGNED
@ STORE_ADDR_MISALIGNED
Definition
fault_codes.hh:68
gem5::RiscvISA::INT_LOCAL_26
@ INT_LOCAL_26
Definition
fault_codes.hh:122
gem5::RiscvISA::INT_LOCAL_23
@ INT_LOCAL_23
Definition
fault_codes.hh:119
gem5::RiscvISA::INT_LOCAL_5
@ INT_LOCAL_5
Definition
fault_codes.hh:101
gem5::RiscvISA::INT_LOCAL_34
@ INT_LOCAL_34
Definition
fault_codes.hh:130
gem5::RiscvISA::INT_LOCAL_37
@ INT_LOCAL_37
Definition
fault_codes.hh:133
gem5::RiscvISA::AMO_ACCESS
@ AMO_ACCESS
Definition
fault_codes.hh:71
gem5::RiscvISA::INST_ACCESS
@ INST_ACCESS
Definition
fault_codes.hh:63
gem5::RiscvISA::ECALL_USER
@ ECALL_USER
Definition
fault_codes.hh:72
gem5::RiscvISA::AMO_PAGE
@ AMO_PAGE
Definition
fault_codes.hh:79
gem5::RiscvISA::BREAKPOINT
@ BREAKPOINT
Definition
fault_codes.hh:65
gem5::RiscvISA::INT_EXT_SUPER
@ INT_EXT_SUPER
Definition
fault_codes.hh:92
gem5::RiscvISA::INT_LOCAL_22
@ INT_LOCAL_22
Definition
fault_codes.hh:118
gem5::RiscvISA::INT_LOCAL_31
@ INT_LOCAL_31
Definition
fault_codes.hh:127
gem5::RiscvISA::INT_LOCAL_27
@ INT_LOCAL_27
Definition
fault_codes.hh:123
gem5::RiscvISA::LOAD_PAGE
@ LOAD_PAGE
Definition
fault_codes.hh:77
gem5::RiscvISA::VIRTUAL_INST
@ VIRTUAL_INST
Definition
fault_codes.hh:82
gem5::RiscvISA::INT_LOCAL_24
@ INT_LOCAL_24
Definition
fault_codes.hh:120
gem5::RiscvISA::STORE_GUEST_PAGE
@ STORE_GUEST_PAGE
Definition
fault_codes.hh:83
gem5::RiscvISA::INT_LOCAL_25
@ INT_LOCAL_25
Definition
fault_codes.hh:121
gem5::RiscvISA::AMO_GUEST_PAGE
@ AMO_GUEST_PAGE
Definition
fault_codes.hh:84
gem5::RiscvISA::INT_LOCAL_6
@ INT_LOCAL_6
Definition
fault_codes.hh:102
gem5::RiscvISA::INT_LOCAL_29
@ INT_LOCAL_29
Definition
fault_codes.hh:125
gem5::RiscvISA::AMO_ADDR_MISALIGNED
@ AMO_ADDR_MISALIGNED
Definition
fault_codes.hh:69
gem5::RiscvISA::INT_LOCAL_10
@ INT_LOCAL_10
Definition
fault_codes.hh:106
gem5::RiscvISA::INT_LOCAL_3
@ INT_LOCAL_3
Definition
fault_codes.hh:99
gem5::RiscvISA::INT_LOCAL_40
@ INT_LOCAL_40
Definition
fault_codes.hh:136
gem5::RiscvISA::INT_EXT_VIRTUAL_SUPER
@ INT_EXT_VIRTUAL_SUPER
Definition
fault_codes.hh:93
gem5::RiscvISA::INT_LOCAL_41
@ INT_LOCAL_41
Definition
fault_codes.hh:137
gem5::RiscvISA::INT_LOCAL_32
@ INT_LOCAL_32
Definition
fault_codes.hh:128
gem5::RiscvISA::INT_LOCAL_9
@ INT_LOCAL_9
Definition
fault_codes.hh:105
gem5::RiscvISA::INT_LOCAL_46
@ INT_LOCAL_46
Definition
fault_codes.hh:142
gem5::RiscvISA::INST_PAGE
@ INST_PAGE
Definition
fault_codes.hh:76
gem5::RiscvISA::INT_LOCAL_12
@ INT_LOCAL_12
Definition
fault_codes.hh:108
gem5::RiscvISA::INT_TIMER_SUPER
@ INT_TIMER_SUPER
Definition
fault_codes.hh:89
gem5::RiscvISA::INT_TIMER_VIRTUAL_SUPER
@ INT_TIMER_VIRTUAL_SUPER
Definition
fault_codes.hh:90
gem5::RiscvISA::INST_ADDR_MISALIGNED
@ INST_ADDR_MISALIGNED
Definition
fault_codes.hh:62
gem5::RiscvISA::STORE_PAGE
@ STORE_PAGE
Definition
fault_codes.hh:78
gem5::RiscvISA::INT_LOCAL_14
@ INT_LOCAL_14
Definition
fault_codes.hh:110
gem5::RiscvISA::ECALL_MACHINE
@ ECALL_MACHINE
Definition
fault_codes.hh:75
gem5::RiscvISA::INT_SOFTWARE_VIRTUAL_SUPER
@ INT_SOFTWARE_VIRTUAL_SUPER
Definition
fault_codes.hh:87
gem5::RiscvISA::INT_LOCAL_11
@ INT_LOCAL_11
Definition
fault_codes.hh:107
gem5::RiscvISA::INT_LOCAL_36
@ INT_LOCAL_36
Definition
fault_codes.hh:132
gem5::RiscvISA::INT_LOCAL_2
@ INT_LOCAL_2
Definition
fault_codes.hh:98
gem5::RiscvISA::INT_LOCAL_4
@ INT_LOCAL_4
Definition
fault_codes.hh:100
gem5::RiscvISA::INT_LOCAL_35
@ INT_LOCAL_35
Definition
fault_codes.hh:131
gem5::RiscvISA::INT_LOCAL_47
@ INT_LOCAL_47
Definition
fault_codes.hh:143
gem5::RiscvISA::INT_LOCAL_19
@ INT_LOCAL_19
Definition
fault_codes.hh:115
gem5::RiscvISA::INT_LOCAL_39
@ INT_LOCAL_39
Definition
fault_codes.hh:135
gem5::RiscvISA::INT_LOCAL_8
@ INT_LOCAL_8
Definition
fault_codes.hh:104
gem5::RiscvISA::INT_LOCAL_0
@ INT_LOCAL_0
Definition
fault_codes.hh:96
gem5::RiscvISA::INT_TIMER_MACHINE
@ INT_TIMER_MACHINE
Definition
fault_codes.hh:91
gem5::RiscvISA::INT_LOCAL_38
@ INT_LOCAL_38
Definition
fault_codes.hh:134
gem5::RiscvISA::INT_LOCAL_45
@ INT_LOCAL_45
Definition
fault_codes.hh:141
gem5::RiscvISA::INT_LOCAL_16
@ INT_LOCAL_16
Definition
fault_codes.hh:112
gem5::RiscvISA::INT_NMI
@ INT_NMI
Definition
fault_codes.hh:148
gem5::RiscvISA::ECALL_SUPER
@ ECALL_SUPER
Definition
fault_codes.hh:73
gem5::RiscvISA::INT_SOFTWARE_SUPER
@ INT_SOFTWARE_SUPER
Definition
fault_codes.hh:86
gem5::RiscvISA::INT_LOCAL_7
@ INT_LOCAL_7
Definition
fault_codes.hh:103
gem5::RiscvISA::INT_LOCAL_30
@ INT_LOCAL_30
Definition
fault_codes.hh:126
gem5::RiscvISA::INT_EXT_MACHINE
@ INT_EXT_MACHINE
Definition
fault_codes.hh:94
gem5::RiscvISA::STORE_ACCESS
@ STORE_ACCESS
Definition
fault_codes.hh:70
gem5::RiscvISA::INT_SOFTWARE_MACHINE
@ INT_SOFTWARE_MACHINE
Definition
fault_codes.hh:88
gem5::RiscvISA::INST_ILLEGAL
@ INST_ILLEGAL
Definition
fault_codes.hh:64
gem5::RiscvISA::INT_LOCAL_44
@ INT_LOCAL_44
Definition
fault_codes.hh:140
gem5::RiscvISA::INT_LOCAL_17
@ INT_LOCAL_17
Definition
fault_codes.hh:113
gem5::RiscvISA::INT_LOCAL_33
@ INT_LOCAL_33
Definition
fault_codes.hh:129
gem5::RiscvISA::LOAD_ADDR_MISALIGNED
@ LOAD_ADDR_MISALIGNED
Definition
fault_codes.hh:66
gem5::RiscvISA::ECALL_VIRTUAL_SUPER
@ ECALL_VIRTUAL_SUPER
Definition
fault_codes.hh:74
gem5::RiscvISA::INT_LOCAL_13
@ INT_LOCAL_13
Definition
fault_codes.hh:109
gem5::RiscvISA::INST_GUEST_PAGE
@ INST_GUEST_PAGE
Definition
fault_codes.hh:80
gem5::RiscvISA::INT_LOCAL_21
@ INT_LOCAL_21
Definition
fault_codes.hh:117
gem5::RiscvISA::NumInterruptTypes
@ NumInterruptTypes
Definition
fault_codes.hh:144
gem5::RiscvISA::INT_EXT_SUPER_GUEST
@ INT_EXT_SUPER_GUEST
Definition
fault_codes.hh:95
gem5::RiscvISA::INT_LOCAL_1
@ INT_LOCAL_1
Definition
fault_codes.hh:97
gem5::RiscvISA::LOAD_ACCESS
@ LOAD_ACCESS
Definition
fault_codes.hh:67
gem5::RiscvISA::LOAD_GUEST_PAGE
@ LOAD_GUEST_PAGE
Definition
fault_codes.hh:81
gem5::RiscvISA::INT_LOCAL_20
@ INT_LOCAL_20
Definition
fault_codes.hh:116
gem5::RiscvISA::INT_LOCAL_15
@ INT_LOCAL_15
Definition
fault_codes.hh:111
gem5::RiscvISA::INT_LOCAL_18
@ INT_LOCAL_18
Definition
fault_codes.hh:114
gem5::RiscvISA::INT_LOCAL_43
@ INT_LOCAL_43
Definition
fault_codes.hh:139
gem5::RiscvISA::DELEGABLE_EXCPS_WITH_RVH
const RegVal DELEGABLE_EXCPS_WITH_RVH
Definition
fault_codes.hh:173
gem5
Copyright (c) 2024 Arm Limited All rights reserved.
Definition
binary32.hh:36
gem5::RegVal
uint64_t RegVal
Definition
types.hh:173
Generated on Sat Oct 18 2025 08:06:41 for gem5 by
doxygen
1.14.0