42#include "debug/Faults.hh"
82 if (misa.rvh && pp ==
PRV_HS) {
83 panic(
"Privilege in MISCREG_PRV is PRV_HS == 2!");
91 "NMI overwriting M-mode trap handler state");
97 if (pp !=
PRV_M && misa.rvs &&
110 if (pp !=
PRV_M && misa.rvs &&
129 panic(
"Delegating interrupt to user mode is removed.");
156 panic(
"Unknown privilege mode %d.", prv);
171 }
else if (prv ==
PRV_S &&
176 hstatus.spvp =
status.spp;
185 }
else if (prv ==
PRV_S &&
193 vsstatus.spie = vsstatus.sie;
212 panic(
"Unknown case in hypervisor fault handler."
218 uint64_t _cause =
_code;
223 if (pc_state.zcmtSecondFetch()) {
243 isa->clearLoadReservation(tc->
contextId());
247 if (pc_state.zcmtSecondFetch()) {
248 pc_state.zcmtSecondFetch(
false);
251 pc_state.set(isa->rvSext(
addr));
270 std::unique_ptr<PCState> new_pc(
dynamic_cast<PCState *
>(
272 panic_if(!new_pc,
"Failed create new PCState from ISA pointer");
275 new_pc->vtype(vtype);
280 if (mmu !=
nullptr) {
289 panic(
"Unknown instruction 0x%08x at pc %s", rsi->machInst,
298 panic(
"Illegal instruction 0x%08x at pc %s: %s", rsi->machInst,
312 panic(
"Illegal floating-point rounding mode 0x%x at pc %s.",
339 auto addr_fault =
dynamic_cast<AddressFault *
>(fault.get());
341 va = addr_fault->trap_value();
347 va = pgt_fault->getFaultVAddr();
#define DPRINTFS(x, s,...)
virtual PCStateBase * newPCState(Addr new_inst_addr=0) const =0
T * get() const
Directly access the pointer itself without taking a reference.
void invokeSE(ThreadContext *tc, const StaticInstPtr &inst) override
void invokeSE(ThreadContext *tc, const StaticInstPtr &inst) override
void invokeSE(ThreadContext *tc, const StaticInstPtr &inst) override
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
bool isResumableNonMaskableInterrupt(ISA *isa) const
virtual bool mustSetGva() const
virtual RegVal trap_value2() const
bool isGuestPageFault() const
virtual void invokeSE(ThreadContext *tc, const StaticInstPtr &inst)
ExceptionCode exception() const
void invoke(ThreadContext *tc, const StaticInstPtr &inst) override
FaultName name() const override
bool isNonMaskableInterrupt() const
virtual RegVal trap_value() const
Base class for all RISC-V static instructions.
void invokeSE(ThreadContext *tc, const StaticInstPtr &inst) override
const std::string instName
void invokeSE(ThreadContext *tc, const StaticInstPtr &inst) override
void invokeSE(ThreadContext *tc, const StaticInstPtr &inst) override
virtual void advancePC(PCStateBase &pc_state) const =0
Workload * workload
OS kernel.
bool trapToGdb(GDBSignal signal, ContextID ctx_id) const
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual RegVal readMiscReg(RegIndex misc_reg)=0
virtual void setMiscReg(RegIndex misc_reg, RegVal val)=0
virtual System * getSystemPtr()=0
virtual BaseISA * getIsaPtr() const =0
virtual BaseCPU * getCpuPtr()=0
virtual const PCStateBase & pcState() const =0
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
virtual BaseMMU * getMMUPtr()=0
virtual ContextID contextId() const =0
virtual void syscall(ThreadContext *tc)
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
#define panic(...)
This implements a cprintf based panic() function.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
#define warn_if(cond,...)
Conditional warning macro that checks the supplied condition and only prints a warning if the conditi...
const RegVal CAUSE_INTERRUPT_MASKS[enums::Num_RiscvType]
void resetV(ExecContext *xc)
bool getFaultVAddr(Fault fault, Addr &va)
Returns true if the fault passed as a first argument was triggered by a memory access,...
bool virtualizationEnabled(ExecContext *xc)
@ INT_TIMER_VIRTUAL_SUPER
@ INT_SOFTWARE_VIRTUAL_SUPER
Copyright (c) 2024 Arm Limited All rights reserved.
std::shared_ptr< FaultBase > Fault
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
RefCountingPtr< StaticInst > StaticInstPtr
void schedRelBreak(Tick delta)
Cause the simulator to execute a breakpoint relative to the current tick.