Deleted Added
sdiff udiff text old ( 12848:67652b15de3b ) new ( 12849:7f43ad13ebf0 )
full compact
1/*
2 * Copyright (c) 2016 RISC-V Foundation
3 * Copyright (c) 2016 The University of Virginia
4 * Copyright (c) 2018 TU Dresden
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are

--- 115 unchanged lines hidden (view full) ---

124 const FaultName _name;
125 bool _interrupt;
126 const ExceptionCode _code;
127
128 RiscvFault(FaultName n, bool i, ExceptionCode c)
129 : _name(n), _interrupt(i), _code(c)
130 {}
131
132 FaultName name() const { return _name; }
133 bool isInterrupt() const { return _interrupt; }
134 ExceptionCode exception() const { return _code; }
135
136 virtual void invokeSE(ThreadContext *tc, const StaticInstPtr &inst);
137 void invoke(ThreadContext *tc, const StaticInstPtr &inst) override;
138};
139
140class Reset : public FaultBase
141{
142

--- 11 unchanged lines hidden (view full) ---

154 void
155 invoke(ThreadContext *tc, const StaticInstPtr &inst =
156 StaticInst::nullStaticInstPtr) override;
157
158 private:
159 const FaultName _name;
160};
161
162class UnknownInstFault : public RiscvFault
163{
164 public:
165 UnknownInstFault() : RiscvFault("Unknown instruction", false, INST_ILLEGAL)
166 {}
167
168 void invokeSE(ThreadContext *tc, const StaticInstPtr &inst) override;
169};
170
171class IllegalInstFault : public RiscvFault
172{
173 private:
174 const std::string reason;
175
176 public:
177 IllegalInstFault(std::string r)
178 : RiscvFault("Illegal instruction", false, INST_ILLEGAL)
179 {}
180
181 void invokeSE(ThreadContext *tc, const StaticInstPtr &inst) override;
182};
183
184class UnimplementedFault : public RiscvFault
185{
186 private:
187 const std::string instName;
188
189 public:
190 UnimplementedFault(std::string name)
191 : RiscvFault("Unimplemented instruction", false, INST_ILLEGAL),
192 instName(name)
193 {}
194
195 void invokeSE(ThreadContext *tc, const StaticInstPtr &inst) override;
196};
197
198class IllegalFrmFault: public RiscvFault
199{
200 private:
201 const uint8_t frm;
202
203 public:
204 IllegalFrmFault(uint8_t r)
205 : RiscvFault("Illegal floating-point rounding mode", false,
206 INST_ILLEGAL),
207 frm(r)
208 {}
209
210 void invokeSE(ThreadContext *tc, const StaticInstPtr &inst) override;
211};
212
213class BreakpointFault : public RiscvFault
214{
215 public:
216 BreakpointFault() : RiscvFault("Breakpoint", false, BREAKPOINT) {}
217 void invokeSE(ThreadContext *tc, const StaticInstPtr &inst) override;
218};
219
220class SyscallFault : public RiscvFault
221{
222 public:
223 // TODO: replace ECALL_USER with the appropriate privilege level of the
224 // caller
225 SyscallFault() : RiscvFault("System call", false, ECALL_USER) {}
226 void invokeSE(ThreadContext *tc, const StaticInstPtr &inst) override;
227};
228
229} // namespace RiscvISA
230
231#endif // __ARCH_RISCV_FAULTS_HH__