Commit 3fa8cad7 authored by David Hildenbrand's avatar David Hildenbrand Committed by Christian Borntraeger

KVM: s390: prepare to read random guest instructions

We will have to read instructions not residing at the current PSW
address.
Reviewed-by: default avatarEric Farman <farman@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Cc: David Hildenbrand <david@redhat.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
parent f4171178
...@@ -247,10 +247,11 @@ int read_guest(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar, void *data, ...@@ -247,10 +247,11 @@ int read_guest(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar, void *data,
/** /**
* read_guest_instr - copy instruction data from guest space to kernel space * read_guest_instr - copy instruction data from guest space to kernel space
* @vcpu: virtual cpu * @vcpu: virtual cpu
* @ga: guest address
* @data: destination address in kernel space * @data: destination address in kernel space
* @len: number of bytes to copy * @len: number of bytes to copy
* *
* Copy @len bytes from the current psw address (guest space) to @data (kernel * Copy @len bytes from the given address (guest space) to @data (kernel
* space). * space).
* *
* The behaviour of read_guest_instr is identical to read_guest, except that * The behaviour of read_guest_instr is identical to read_guest, except that
...@@ -258,10 +259,10 @@ int read_guest(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar, void *data, ...@@ -258,10 +259,10 @@ int read_guest(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar, void *data,
* address-space mode. * address-space mode.
*/ */
static inline __must_check static inline __must_check
int read_guest_instr(struct kvm_vcpu *vcpu, void *data, unsigned long len) int read_guest_instr(struct kvm_vcpu *vcpu, unsigned long ga, void *data,
unsigned long len)
{ {
return access_guest(vcpu, vcpu->arch.sie_block->gpsw.addr, 0, data, len, return access_guest(vcpu, ga, 0, data, len, GACC_IFETCH);
GACC_IFETCH);
} }
/** /**
......
...@@ -2588,7 +2588,7 @@ static int vcpu_post_run_fault_in_sie(struct kvm_vcpu *vcpu) ...@@ -2588,7 +2588,7 @@ static int vcpu_post_run_fault_in_sie(struct kvm_vcpu *vcpu)
* to look up the current opcode to get the length of the instruction * to look up the current opcode to get the length of the instruction
* to be able to forward the PSW. * to be able to forward the PSW.
*/ */
rc = read_guest_instr(vcpu, &opcode, 1); rc = read_guest_instr(vcpu, vcpu->arch.sie_block->gpsw.addr, &opcode, 1);
ilen = insn_length(opcode); ilen = insn_length(opcode);
if (rc < 0) { if (rc < 0) {
return rc; return rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment