Go to the documentation of this file.
40 #include <linux/kvm.h>
45 #include "debug/KvmContext.hh"
46 #include "params/ArmV8KvmCPU.hh"
51 using namespace ArmISA;
56 static_assert(
NUM_XREGS == 31,
"Unexpected number of aarch64 int. regs.");
61 static_assert(
NUM_QREGS == 32,
"Unexpected number of aarch64 vector regs.");
63 #define EXTRACT_FIELD(v, name) \
64 (((v) & name ## _MASK) >> name ## _SHIFT)
66 #define CORE_REG(name, size) \
67 (KVM_REG_ARM64 | KVM_REG_ARM_CORE | \
68 KVM_REG_SIZE_ ## size | \
69 KVM_REG_ARM_CORE_REG(name))
71 #define INT_REG(name) CORE_REG(name, U64)
72 #define SIMD_REG(name) CORE_REG(name, U128)
74 #define SYS_MPIDR_EL1 ARM64_SYS_REG(0b11, 0b000, 0b0000, 0b0000, 0b101)
107 #define FP_REGS_PER_VFP_REG 4
152 DPRINTF(KvmContext,
" %s := 0x%x\n",
ri.name, value);
160 inform(
"Integer registers:\n");
180 const uint64_t arch(
reg & KVM_REG_ARCH_MASK);
181 if (arch != KVM_REG_ARM64) {
186 const uint64_t
type(
reg & KVM_REG_ARM_COPROC_MASK);
188 case KVM_REG_ARM_CORE:
192 case KVM_REG_ARM64_SYSREG: {
201 inform(
" %s (op0: %i, op1: %i, crn: %i, crm: %i, op2: %i): %s",
206 case KVM_REG_ARM_DEMUX: {
209 if (
id == KVM_REG_ARM_DEMUX_ID_CCSIDR) {
227 DPRINTF(KvmContext,
"In updateKvmState():\n");
239 DPRINTF(KvmContext,
" %s := 0x%x\n",
"PSTATE", cpsr);
244 DPRINTF(KvmContext,
" %s := 0x%x\n",
ri.name, value);
250 DPRINTF(KvmContext,
" X%i := 0x%x\n",
i, value);
256 DPRINTF(KvmContext,
" %s := 0x%x\n",
ri.name, value);
286 DPRINTF(KvmContext,
" %s := 0x%x\n",
ri.name, value);
297 DPRINTF(KvmContext,
"In updateThreadContext():\n");
301 DPRINTF(KvmContext,
" %s := 0x%x\n",
"PSTATE", cpsr);
314 DPRINTF(KvmContext,
" %s := 0x%x\n",
ri.name, value);
320 DPRINTF(KvmContext,
" X%i := 0x%x\n",
i, value);
332 DPRINTF(KvmContext,
" %s := 0x%x\n",
ri.name, value);
351 DPRINTF(KvmContext,
" %s := 0x%x\n",
ri.name, value);
369 pc.nextThumb(cpsr.t);
370 DPRINTF(KvmContext,
" PC := 0x%x (t: %i, a64: %i)\n",
371 pc.instAddr(),
pc.thumb(),
pc.aarch64());
383 const uint64_t arch(
reg & KVM_REG_ARCH_MASK);
384 if (arch != KVM_REG_ARM64)
387 const uint64_t
type(
reg & KVM_REG_ARM_COPROC_MASK);
388 if (
type != KVM_REG_ARM64_SYSREG)
398 const bool writeable(
403 const bool implemented(
408 if (implemented && writeable)
Addr instAddr() const
Returns the memory address of the instruction this PC points to.
virtual RegVal readMiscReg(RegIndex misc_reg)=0
void startup() override
startup() is the final initialization call before simulation.
static const std::vector< ArmV8KvmCPU::MiscRegInfo > miscRegMap
Mapping between gem5 misc registers and registers in kvm.
virtual RegVal getReg(const RegId ®) const
EventQueue * deviceEventQueue()
Get a pointer to the event queue owning devices.
virtual const PCStateBase & pcState() const =0
void updateThreadContext() override
Update the current thread context with the KVM state.
MiscRegIndex decodeAArch64SysReg(unsigned op0, unsigned op1, unsigned crn, unsigned crm, unsigned op2)
const char *const miscRegName[]
static const std::vector< ArmV8KvmCPU::MiscRegInfo > miscRegIdMap
Mapping between gem5 ID misc registers and registers in kvm.
std::string getAndFormatOneReg(uint64_t id) const
Get and format one register for printout.
bool inAArch64(ThreadContext *tc)
void getOneReg(uint64_t id, void *addr) const
constexpr uint64_t kvmFPReg(const int num)
constexpr uint64_t kvmXReg(const int num)
Vector Register Abstraction This generic class is the model in a particularization of MVC,...
VecElem * as()
View interposers.
std::vector< struct MiscRegLUTEntry > lookUpMiscReg(NUM_MISCREGS)
ThreadContext * tc
ThreadContext object, provides an interface for external objects to modify this thread's state.
#define FP_REGS_PER_VFP_REG
static const std::vector< ArmV8KvmCPU::IntRegInfo > intRegMap
Mapping between gem5 integer registers and integer registers in kvm.
void syncVecElemsToRegs(ThreadContext *tc)
constexpr RegClass intRegClass
void setOneReg(uint64_t id, const void *addr)
Get/Set single register using the KVM_(SET|GET)_ONE_REG API.
const std::vector< ArmV8KvmCPU::MiscRegInfo > & getSysRegMap() const
Get a map between system registers in kvm and gem5 registers.
void updateKvmState() override
Update the KVM state from the current thread context.
virtual void * getWritableReg(const RegId ®)=0
constexpr static unsigned NUM_XREGS
constexpr RegClass flatIntRegClass
void dump() const override
Dump the internal state to the terminal.
constexpr RegClass vecRegClass
ArmV8KvmCPU(const ArmV8KvmCPUParams ¶ms)
void syncVecRegsToElems(ThreadContext *tc)
constexpr static unsigned NUM_QREGS
uint64_t getOneRegU64(uint64_t id) const
virtual void setMiscReg(RegIndex misc_reg, RegVal val)=0
const int NumVecV8ArchRegs
const RegIndexVector & getRegList() const
Get a list of registers supported by getOneReg() and setOneReg().
std::vector< ArmV8KvmCPU::MiscRegInfo > sysRegMap
Cached mapping between system registers in kvm and misc regs in gem5.
#define EXTRACT_FIELD(v, name)
void startup() override
startup() is the final initialization call before simulation.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
static const std::set< ArmISA::MiscRegIndex > deviceRegSet
Device registers (needing "effectful" MiscReg writes)
#define CORE_REG(name, size)
virtual void setMiscRegNoEffect(RegIndex misc_reg, RegVal val)=0
virtual void setReg(const RegId ®, RegVal val)
Generated on Sun Jul 30 2023 01:56:49 for gem5 by doxygen 1.8.17