diff options
author | Madhavan Srinivasan <maddy@linux.vnet.ibm.com> | 2014-09-09 22:37:35 +0530 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2014-09-22 10:11:35 +0200 |
commit | a59c1d9e609c4bbad9ec3b238221ecf3b9ca091b (patch) | |
tree | ba1f264b568db3ca4ff579ccf6fe935b75d635ec /arch/powerpc/kvm/emulate.c | |
parent | d2ca32a2d4f029b90e4b8f67879a9dfead0c85fa (diff) | |
download | linux-a59c1d9e609c4bbad9ec3b238221ecf3b9ca091b.tar.bz2 |
powerpc/kvm: support to handle sw breakpoint
This patch adds kernel side support for software breakpoint.
Design is that, by using an illegal instruction, we trap to hypervisor
via Emulation Assistance interrupt, where we check for the illegal instruction
and accordingly we return to Host or Guest. Patch also adds support for
software breakpoint in PR KVM.
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/emulate.c')
-rw-r--r-- | arch/powerpc/kvm/emulate.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c index e96b50d0bdab..005222b580ea 100644 --- a/arch/powerpc/kvm/emulate.c +++ b/arch/powerpc/kvm/emulate.c @@ -274,6 +274,21 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu) } break; + case 0: + /* + * Instruction with primary opcode 0. Based on PowerISA + * these are illegal instructions. + */ + if (inst == KVMPPC_INST_SW_BREAKPOINT) { + run->exit_reason = KVM_EXIT_DEBUG; + run->debug.arch.address = kvmppc_get_pc(vcpu); + emulated = EMULATE_EXIT_USER; + advance = 0; + } else + emulated = EMULATE_FAIL; + + break; + default: emulated = EMULATE_FAIL; } |