]> git.karo-electronics.de Git - linux-beck.git/commitdiff
KVM: s390: pfmf: take care of amode when setting reg2
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Wed, 13 Apr 2016 13:47:21 +0000 (15:47 +0200)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Fri, 10 Jun 2016 10:07:29 +0000 (12:07 +0200)
Depending on the addressing mode, we must not overwrite bit 0-31 of the
register. In addition, 24 bit and 31 bit have to set certain bits to 0,
which is guaranteed by converting the end address to an effective
address.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/kvm/priv.c

index 5c926b74d7ca8384596d3b441488b2eb1d352e6e..71fa603034d0573f66b90c2780d431b5d777d0ea 100644 (file)
@@ -733,8 +733,15 @@ static int handle_pfmf(struct kvm_vcpu *vcpu)
 
                start += PAGE_SIZE;
        }
-       if (vcpu->run->s.regs.gprs[reg1] & PFMF_FSC)
-               vcpu->run->s.regs.gprs[reg2] = end;
+       if (vcpu->run->s.regs.gprs[reg1] & PFMF_FSC) {
+               if (psw_bits(vcpu->arch.sie_block->gpsw).eaba == PSW_AMODE_64BIT) {
+                       vcpu->run->s.regs.gprs[reg2] = end;
+               } else {
+                       vcpu->run->s.regs.gprs[reg2] &= ~0xffffffffUL;
+                       end = kvm_s390_logical_to_effective(vcpu, end);
+                       vcpu->run->s.regs.gprs[reg2] |= end;
+               }
+       }
        return 0;
 }