45#include "debug/KvmContext.hh"
46#include "params/ArmV8KvmCPU.hh"
51using namespace ArmISA;
56static_assert(
NUM_XREGS == 31,
"Unexpected number of aarch64 int. regs.");
61static_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)
#define CORE_REG(name, size)
#define FP_REGS_PER_VFP_REG
#define EXTRACT_FIELD(v, name)
void updateKvmState() override
Update the KVM state from the current thread context.
static const std::set< ArmISA::MiscRegIndex > deviceRegSet
Device registers (needing "effectful" MiscReg writes)
void dump() const override
Dump the internal state to the terminal.
ArmV8KvmCPU(const ArmV8KvmCPUParams ¶ms)
static const std::vector< ArmV8KvmCPU::IntRegInfo > intRegMap
Mapping between gem5 integer registers and integer registers in kvm.
static const std::vector< ArmV8KvmCPU::MiscRegInfo > miscRegMap
Mapping between gem5 misc registers and registers in kvm.
const std::vector< ArmV8KvmCPU::MiscRegInfo > & getSysRegMap() const
Get a map between system registers in kvm and gem5 registers.
void startup() override
startup() is the final initialization call before simulation.
std::vector< ArmV8KvmCPU::MiscRegInfo > sysRegMap
Cached mapping between system registers in kvm and misc regs in gem5.
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.
const RegIndexVector & getRegList() const
Get a list of registers supported by getOneReg() and setOneReg().
void startup() override
startup() is the final initialization call before simulation.
void getOneReg(uint64_t id, void *addr) const
uint64_t getOneRegU64(uint64_t id) const
std::string getAndFormatOneReg(uint64_t id) const
Get and format one register for printout.
void setOneReg(uint64_t id, const void *addr)
Get/Set single register using the KVM_(SET|GET)_ONE_REG API.
EventQueue * deviceEventQueue()
Get a pointer to the event queue owning devices.
ThreadContext * tc
ThreadContext object, provides an interface for external objects to modify this thread's state.
Addr instAddr() const
Returns the memory address of the instruction this PC points to.
virtual RegVal readMiscReg(RegIndex misc_reg)=0
virtual void setMiscReg(RegIndex misc_reg, RegVal val)=0
virtual RegVal getReg(const RegId ®) const
virtual void setMiscRegNoEffect(RegIndex misc_reg, RegVal val)=0
virtual void setReg(const RegId ®, RegVal val)
virtual void * getWritableReg(const RegId ®)=0
virtual const PCStateBase & pcState() const =0
Vector Register Abstraction This generic class is the model in a particularization of MVC,...
VecElem * as()
View interposers.
static RegId x(unsigned index)
constexpr RegClass flatIntRegClass
const int NumVecV8ArchRegs
void syncVecRegsToElems(ThreadContext *tc)
MiscRegIndex decodeAArch64SysReg(unsigned op0, unsigned op1, unsigned crn, unsigned crm, unsigned op2)
constexpr RegClass intRegClass
void syncVecElemsToRegs(ThreadContext *tc)
const char *const miscRegName[]
bool inAArch64(ThreadContext *tc)
std::vector< struct MiscRegLUTEntry > lookUpMiscReg(NUM_MISCREGS)
constexpr RegClass vecRegClass
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
static constexpr unsigned NUM_XREGS
constexpr uint64_t kvmFPReg(const int num)
constexpr uint64_t kvmXReg(const int num)
static constexpr unsigned NUM_QREGS
union gem5::KvmFPReg::@10 s[4]
union gem5::KvmFPReg::@11 d[2]