Go to the documentation of this file.
40 #include <linux/kvm.h>
42 #include "debug/KvmContext.hh"
43 #include "params/ArmV8KvmCPU.hh"
50 static_assert(
NUM_XREGS == 31,
"Unexpected number of aarch64 int. regs.");
55 static_assert(
NUM_QREGS == 32,
"Unexpected number of aarch64 vector regs.");
57 #define EXTRACT_FIELD(v, name) \
58 (((v) & name ## _MASK) >> name ## _SHIFT)
60 #define CORE_REG(name, size) \
61 (KVM_REG_ARM64 | KVM_REG_ARM_CORE | \
62 KVM_REG_SIZE_ ## size | \
63 KVM_REG_ARM_CORE_REG(name))
65 #define INT_REG(name) CORE_REG(name, U64)
66 #define SIMD_REG(name) CORE_REG(name, U128)
68 #define SYS_MPIDR_EL1 ARM64_SYS_REG(0b11, 0b000, 0b0000, 0b0000, 0b101)
98 #define FP_REGS_PER_VFP_REG 4
143 DPRINTF(KvmContext,
" %s := 0x%x\n", ri.name, value);
151 inform(
"Integer registers:\n");
171 const uint64_t arch(
reg & KVM_REG_ARCH_MASK);
172 if (arch != KVM_REG_ARM64) {
177 const uint64_t
type(
reg & KVM_REG_ARM_COPROC_MASK);
179 case KVM_REG_ARM_CORE:
183 case KVM_REG_ARM64_SYSREG: {
192 inform(
" %s (op0: %i, op1: %i, crn: %i, crm: %i, op2: %i): %s",
197 case KVM_REG_ARM_DEMUX: {
200 if (
id == KVM_REG_ARM_DEMUX_ID_CCSIDR) {
218 DPRINTF(KvmContext,
"In updateKvmState():\n");
230 DPRINTF(KvmContext,
" %s := 0x%x\n",
"PSTATE", cpsr);
235 DPRINTF(KvmContext,
" %s := 0x%x\n", ri.name, value);
241 DPRINTF(KvmContext,
" X%i := 0x%x\n",
i, value);
247 DPRINTF(KvmContext,
" %s := 0x%x\n", ri.name, value);
273 DPRINTF(KvmContext,
" %s := 0x%x\n", ri.name, value);
284 DPRINTF(KvmContext,
"In updateThreadContext():\n");
288 DPRINTF(KvmContext,
" %s := 0x%x\n",
"PSTATE", cpsr);
301 DPRINTF(KvmContext,
" %s := 0x%x\n", ri.name, value);
307 DPRINTF(KvmContext,
" X%i := 0x%x\n",
i, value);
319 DPRINTF(KvmContext,
" %s := 0x%x\n", ri.name, value);
334 DPRINTF(KvmContext,
" %s := 0x%x\n", ri.name, value);
352 pc.nextThumb(cpsr.t);
353 DPRINTF(KvmContext,
" PC := 0x%x (t: %i, a64: %i)\n",
354 pc.instAddr(),
pc.thumb(),
pc.aarch64());
366 const uint64_t arch(
reg & KVM_REG_ARCH_MASK);
367 if (arch != KVM_REG_ARM64)
370 const uint64_t
type(
reg & KVM_REG_ARM_COPROC_MASK);
371 if (
type != KVM_REG_ARM64_SYSREG)
381 const bool writeable(
386 const bool implemented(
391 if (implemented && writeable)
400 ArmV8KvmCPUParams::create()
void setOneReg(uint64_t id, const void *addr)
Get/Set single register using the KVM_(SET|GET)_ONE_REG API.
const IntRegMap IntReg64Map
static const std::vector< ArmV8KvmCPU::MiscRegInfo > miscRegMap
Mapping between gem5 misc registers and registers in kvm.
virtual VecRegContainer & getWritableVecReg(const RegId ®)=0
constexpr static unsigned NUM_XREGS
std::string getAndFormatOneReg(uint64_t id) const
Get and format one register for printout.
virtual void setIntReg(RegIndex reg_idx, RegVal val)=0
const std::vector< ArmV8KvmCPU::MiscRegInfo > & getSysRegMap() const
Get a map between system registers in kvm and gem5 registers.
This is an implementation of a KVM-based ARMv8-compatible CPU.
static const std::vector< ArmV8KvmCPU::MiscRegInfo > miscRegIdMap
Mapping between gem5 ID misc registers and registers in kvm.
void updateThreadContext() override
Update the current thread context with the KVM state.
void getOneReg(uint64_t id, void *addr) const
const int NumVecV8ArchRegs
const char *const miscRegName[]
uint64_t getOneRegU64(uint64_t id) const
Register ID: describe an architectural register with its class and index.
VecRegT< VecElem, NumElems, true > as() const
View interposers.
constexpr uint64_t kvmXReg(const int num)
void updateKvmState() override
Update the KVM state from the current thread context.
ArmV8KvmCPU(ArmV8KvmCPUParams *params)
virtual void setIntRegFlat(RegIndex idx, RegVal val)=0
#define FP_REGS_PER_VFP_REG
virtual const VecRegContainer & readVecReg(const RegId ®) const =0
const RegIndexVector & getRegList() const
Get a list of registers supported by getOneReg() and setOneReg().
void dump() const override
Dump the internal state to the terminal.
EventQueue * deviceEventQueue()
Get a pointer to the event queue owning devices.
static const std::set< ArmISA::MiscRegIndex > deviceRegSet
Device registers (needing "effectful" MiscReg writes)
constexpr static unsigned NUM_QREGS
virtual TheISA::PCState pcState() const =0
std::vector< ArmV8KvmCPU::MiscRegInfo > sysRegMap
Cached mapping between system registers in kvm and misc regs in gem5.
virtual RegVal readCCReg(RegIndex reg_idx) const =0
@ VecRegClass
Vector Register.
virtual void setCCReg(RegIndex reg_idx, RegVal val)=0
ThreadContext * tc
ThreadContext object, provides an interface for external objects to modify this thread's state.
GenericISA::DelaySlotPCState< MachInst > PCState
virtual RegVal readMiscReg(RegIndex misc_reg)=0
virtual void setMiscReg(RegIndex misc_reg, RegVal val)=0
MiscRegIndex decodeAArch64SysReg(unsigned op0, unsigned op1, unsigned crn, unsigned crm, unsigned op2)
constexpr uint64_t kvmFPReg(const int num)
virtual void setMiscRegNoEffect(RegIndex misc_reg, RegVal val)=0
#define EXTRACT_FIELD(v, name)
bool inAArch64(ThreadContext *tc)
virtual RegVal readIntReg(RegIndex reg_idx) const =0
static const std::vector< ArmV8KvmCPU::IntRegInfo > intRegMap
Mapping between gem5 integer registers and integer registers in kvm.
virtual Addr instAddr() const =0
bitset< NUM_MISCREG_INFOS > miscRegInfo[NUM_MISCREGS]
#define CORE_REG(name, size)
Generated on Wed Sep 30 2020 14:02:00 for gem5 by doxygen 1.8.17