s390x/kvm: 2 byte software breakpoint support
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Tue, 3 Jun 2014 10:46:50 +0000 (12:46 +0200)
committerCornelia Huck <cornelia.huck@de.ibm.com>
Mon, 5 Sep 2016 13:15:16 +0000 (15:15 +0200)
commitb60fae32ff33cbaab76d14cc5f55b979cf58516d
treeebedeb91767be37c94cca0bb3a94bbe84fe04394
parentdbdfea9226c9d0bdd149272514f47862e03f4ebe
s390x/kvm: 2 byte software breakpoint support

Diag 501 (4 bytes) was used until now for software breakpoints on s390.
As instructions on s390 might be 2 bytes long, temporarily overwriting them
with 4 bytes is evil and can result in very strange guest behaviour.

We make use of invalid instruction 0x0000 as new sw breakpoint instruction.
We have to enable interception of that instruction in KVM using a
capability.

If no software breakpoint has been inserted at the reported position, an
operation exception has to be injected into the guest. Otherwise a
breakpoint has been hit and the pc has to be rewound.

If KVM doesn't yet support interception of instruction 0x0000 the
existing mechanism exploiting diag 501 is used. To keep overhead low,
interception of instruction 0x0000 will only be enabled if sw breakpoints
are really used.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
target-s390x/cpu.h
target-s390x/kvm.c