gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions | Variables
arm_cpu.cc File Reference
#include "arch/arm/kvm/arm_cpu.hh"
#include <linux/kvm.h>
#include <algorithm>
#include <cerrno>
#include <memory>
#include "arch/registers.hh"
#include "cpu/kvm/base.hh"
#include "debug/Kvm.hh"
#include "debug/KvmContext.hh"
#include "debug/KvmInt.hh"
#include "sim/pseudo_inst.hh"

Go to the source code of this file.

Macros

#define EXTRACT_FIELD(val, mask, shift)   (((val) & (mask)) >> (shift))
 
#define REG_IS_ARM(id)   (((id) & KVM_REG_ARCH_MASK) == KVM_REG_ARM)
 
#define REG_IS_32BIT(id)   (((id) & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U32)
 
#define REG_IS_64BIT(id)   (((id) & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U64)
 
#define REG_IS_CP(id, cp)   (((id) & KVM_REG_ARM_COPROC_MASK) == (cp))
 
#define REG_IS_CORE(id)   REG_IS_CP((id), KVM_REG_ARM_CORE)
 
#define REG_IS_VFP(id)   REG_IS_CP((id), KVM_REG_ARM_VFP)
 
#define REG_VFP_REG(id)   ((id) & KVM_REG_ARM_VFP_MASK)
 
#define REG_IS_VFP_REG(id)   (REG_VFP_REG(id) < 0x100)
 
#define REG_IS_VFP_CTRL(id)   (REG_VFP_REG(id) >= 0x100)
 
#define REG_IS_DEMUX(id)   REG_IS_CP((id), KVM_REG_ARM_DEMUX)
 
#define REG_CORE_IDX(id)   (~(KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK | KVM_REG_ARM_CORE))
 
#define REG_CP(id)   EXTRACT_FIELD(id, KVM_REG_ARM_COPROC_MASK, KVM_REG_ARM_COPROC_SHIFT)
 
#define REG_CRN(id)   EXTRACT_FIELD(id, KVM_REG_ARM_32_CRN_MASK, KVM_REG_ARM_32_CRN_SHIFT)
 
#define REG_OPC1(id)   EXTRACT_FIELD(id, KVM_REG_ARM_OPC1_MASK, KVM_REG_ARM_OPC1_SHIFT)
 
#define REG_CRM(id)   EXTRACT_FIELD(id, KVM_REG_ARM_CRM_MASK, KVM_REG_ARM_CRM_SHIFT)
 
#define REG_OPC2(id)   EXTRACT_FIELD(id, KVM_REG_ARM_32_OPC2_MASK, KVM_REG_ARM_32_OPC2_SHIFT)
 
#define REG_CP32(cpnum, crn, opc1, crm, opc2)
 
#define REG_CP64(cpnum, opc1, crm)
 
#define REG_CORE32(kname)
 
#define REG_VFP32(regno)
 
#define REG_VFP64(regno)
 
#define REG_DEMUX32(dmxid, val)
 
#define INTERRUPT_ID(type, vcpu, irq)
 
#define INTERRUPT_VCPU_IRQ(vcpu)   INTERRUPT_ID(KVM_ARM_IRQ_TYPE_CPU, vcpu, KVM_ARM_IRQ_CPU_IRQ)
 
#define INTERRUPT_VCPU_FIQ(vcpu)   INTERRUPT_ID(KVM_ARM_IRQ_TYPE_CPU, vcpu, KVM_ARM_IRQ_CPU_FIQ)
 
#define COUNT_OF(l)   (sizeof(l) / sizeof(*l))
 

Functions

static const uint64_t KVM_REG64_TTBR0 (REG_CP64(15, 0, 2))
 
static const uint64_t KVM_REG64_TTBR1 (REG_CP64(15, 1, 2))
 

Variables

static uint64_t invariant_reg_vector []
 

Macro Definition Documentation

#define COUNT_OF (   l)    (sizeof(l) / sizeof(*l))

Definition at line 188 of file arm_cpu.cc.

#define EXTRACT_FIELD (   val,
  mask,
  shift 
)    (((val) & (mask)) >> (shift))

Definition at line 57 of file arm_cpu.cc.

Referenced by ArmKvmCPU::dumpKvmStateCoProc(), and ArmKvmCPU::dumpKvmStateMisc().

#define INTERRUPT_ID (   type,
  vcpu,
  irq 
)
Value:
( \
((type) << KVM_ARM_IRQ_TYPE_SHIFT) | \
((vcpu) << KVM_ARM_IRQ_VCPU_SHIFT) | \
((irq) << KVM_ARM_IRQ_NUM_SHIFT))
type
Definition: misc.hh:728
Bitfield< 1 > irq
Definition: miscregs.hh:1520

Definition at line 176 of file arm_cpu.cc.

#define INTERRUPT_VCPU_FIQ (   vcpu)    INTERRUPT_ID(KVM_ARM_IRQ_TYPE_CPU, vcpu, KVM_ARM_IRQ_CPU_FIQ)

Definition at line 184 of file arm_cpu.cc.

Referenced by ArmKvmCPU::kvmRun().

#define INTERRUPT_VCPU_IRQ (   vcpu)    INTERRUPT_ID(KVM_ARM_IRQ_TYPE_CPU, vcpu, KVM_ARM_IRQ_CPU_IRQ)

Definition at line 181 of file arm_cpu.cc.

Referenced by ArmKvmCPU::kvmRun().

#define REG_CORE32 (   kname)
Value:
( \
(KVM_REG_ARM | KVM_REG_SIZE_U32) | \
(KVM_REG_ARM_CORE) | \
(KVM_REG_ARM_CORE_REG(kname)))

Definition at line 119 of file arm_cpu.cc.

Referenced by ArmKvmCPU::dumpKvmStateCore(), ArmKvmCPU::onKvmExitHypercall(), ArmKvmCPU::updateKvmStateCore(), and ArmKvmCPU::updateTCStateCore().

#define REG_CORE_IDX (   id)    (~(KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK | KVM_REG_ARM_CORE))

Definition at line 87 of file arm_cpu.cc.

#define REG_CP (   id)    EXTRACT_FIELD(id, KVM_REG_ARM_COPROC_MASK, KVM_REG_ARM_COPROC_SHIFT)
#define REG_CP32 (   cpnum,
  crn,
  opc1,
  crm,
  opc2 
)
Value:
( \
(KVM_REG_ARM | KVM_REG_SIZE_U32) | \
((cpnum) << KVM_REG_ARM_COPROC_SHIFT) | \
((crn) << KVM_REG_ARM_32_CRN_SHIFT) | \
((opc1) << KVM_REG_ARM_OPC1_SHIFT) | \
((crm) << KVM_REG_ARM_CRM_SHIFT) | \
((opc2) << KVM_REG_ARM_32_OPC2_SHIFT))
Bitfield< 7, 5 > opc2
Definition: types.hh:111

Definition at line 105 of file arm_cpu.cc.

#define REG_CP64 (   cpnum,
  opc1,
  crm 
)
Value:
( \
(KVM_REG_ARM | KVM_REG_SIZE_U64) | \
((cpnum) << KVM_REG_ARM_COPROC_SHIFT) | \
((opc1) << KVM_REG_ARM_OPC1_SHIFT) | \
((crm) << KVM_REG_ARM_CRM_SHIFT))

Definition at line 113 of file arm_cpu.cc.

#define REG_CRM (   id)    EXTRACT_FIELD(id, KVM_REG_ARM_CRM_MASK, KVM_REG_ARM_CRM_SHIFT)
#define REG_CRN (   id)    EXTRACT_FIELD(id, KVM_REG_ARM_32_CRN_MASK, KVM_REG_ARM_32_CRN_SHIFT)
#define REG_DEMUX32 (   dmxid,
  val 
)
Value:
( \
(KVM_REG_ARM | KVM_REG_SIZE_U32) | \
(dmxid) | (val))
Bitfield< 63 > val
Definition: misc.hh:770

Definition at line 132 of file arm_cpu.cc.

#define REG_IS_32BIT (   id)    (((id) & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U32)
#define REG_IS_64BIT (   id)    (((id) & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U64)
#define REG_IS_ARM (   id)    (((id) & KVM_REG_ARCH_MASK) == KVM_REG_ARM)
#define REG_IS_CORE (   id)    REG_IS_CP((id), KVM_REG_ARM_CORE)
#define REG_IS_CP (   id,
  cp 
)    (((id) & KVM_REG_ARM_COPROC_MASK) == (cp))

Definition at line 69 of file arm_cpu.cc.

#define REG_IS_DEMUX (   id)    REG_IS_CP((id), KVM_REG_ARM_DEMUX)

Definition at line 81 of file arm_cpu.cc.

Referenced by ArmKvmCPU::dumpKvmStateMisc(), and ArmKvmCPU::isInvariantReg().

#define REG_IS_VFP (   id)    REG_IS_CP((id), KVM_REG_ARM_VFP)
#define REG_IS_VFP_CTRL (   id)    (REG_VFP_REG(id) >= 0x100)
#define REG_IS_VFP_REG (   id)    (REG_VFP_REG(id) < 0x100)
#define REG_OPC1 (   id)    EXTRACT_FIELD(id, KVM_REG_ARM_OPC1_MASK, KVM_REG_ARM_OPC1_SHIFT)
#define REG_OPC2 (   id)    EXTRACT_FIELD(id, KVM_REG_ARM_32_OPC2_MASK, KVM_REG_ARM_32_OPC2_SHIFT)
#define REG_VFP32 (   regno)
Value:
( \
(KVM_REG_ARM | KVM_REG_SIZE_U32) | \
KVM_REG_ARM_VFP | (regno))

Definition at line 124 of file arm_cpu.cc.

#define REG_VFP64 (   regno)
Value:
( \
(KVM_REG_ARM | KVM_REG_SIZE_U64) | \
KVM_REG_ARM_VFP | (regno))

Definition at line 128 of file arm_cpu.cc.

#define REG_VFP_REG (   id)    ((id) & KVM_REG_ARM_VFP_MASK)

Definition at line 75 of file arm_cpu.cc.

Referenced by ArmKvmCPU::decodeVFPCtrlReg().

Function Documentation

static const uint64_t KVM_REG64_TTBR0 ( REG_CP64(15, 0, 2)  )
static
static const uint64_t KVM_REG64_TTBR1 ( REG_CP64(15, 1, 2)  )
static

Variable Documentation

uint64_t invariant_reg_vector[]
static

Definition at line 139 of file arm_cpu.cc.


Generated on Fri Jun 9 2017 13:03:55 for gem5 by doxygen 1.8.6