gem5 [DEVELOP-FOR-25.1]
Loading...
Searching...
No Matches
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
34namespace gem5
35{
36
37namespace RiscvISA
38{
39
40
41
42enum FloatException : uint64_t
43{
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 */
60enum ExceptionCode : uint64_t
61{
74 ECALL_VIRTUAL_SUPER = 10, // H-extension
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
87 INT_SOFTWARE_VIRTUAL_SUPER = 2, // H-extension
90 INT_TIMER_VIRTUAL_SUPER = 6, // H-extension
93 INT_EXT_VIRTUAL_SUPER = 10, // H-extension
95 INT_EXT_SUPER_GUEST = 12, // H-extension
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.
149};
150
151
152
153// H-extension useful masks
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
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
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__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
const RegVal VS_DELEGABLE_EXCPS
const RegVal DELEGABLE_EXCPS
const RegVal DELEGABLE_EXCPS_WITH_RVH
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
uint64_t RegVal
Definition types.hh:173

Generated on Mon Oct 27 2025 04:12:59 for gem5 by doxygen 1.14.0