Get trap instruction opcode from KVM and this opcode will
be used for setting software breakpoint in following patch
Signed-off-by: Bharat Bhushan <address@hidden>
---
target-ppc/kvm.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index dfa5a26..4fc005f 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -71,6 +71,8 @@ static int cap_papr;
static int cap_htab_fd;
static int cap_fixup_hcalls;
+static uint32_t debug_inst_opcode;
+
/* XXX We have a race condition where we actually have a level triggered
* interrupt, but the infrastructure can't expose that yet, so the guest
* takes but ignores it, goes to sleep and never gets notified that
there's
@@ -412,6 +414,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
{
PowerPCCPU *cpu = POWERPC_CPU(cs);
CPUPPCState *cenv = &cpu->env;
+ struct kvm_one_reg reg;
int ret;
/* Gather server mmu info from KVM and update the CPU state */
@@ -434,6 +437,14 @@ int kvm_arch_init_vcpu(CPUState *cs)
break;
}
+ reg.id = KVM_REG_PPC_DEBUG_INST,
+ reg.addr = (uintptr_t) &debug_inst_opcode,
+
+ ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®);
+ if (ret) {
+ return ret;
+ }