diff options
author | Thomas Huth <thuth@linux.vnet.ibm.com> | 2014-04-17 03:10:40 -0400 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2014-05-16 08:57:18 -0400 |
commit | a3fb577e481d64dc757f506e19685603bbf3db42 (patch) | |
tree | 6075885e3d1f29a42e1afd9da01c2fe9da1b18c3 /arch/s390 | |
parent | 3a801517ad49f586f2016e1b1321e6cd28a97a04 (diff) |
KVM: s390: Improve is_valid_psw()
As a program status word is also invalid (and thus generates an
specification exception) if the instruction address is not even,
we should test this in is_valid_psw(), too. This patch also exports
the function so that it becomes available for other parts of the
S390 KVM code as well.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/kvm/kvm-s390.h | 1 | ||||
-rw-r--r-- | arch/s390/kvm/priv.c | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h index c28423a3acc0..38b589d69951 100644 --- a/arch/s390/kvm/kvm-s390.h +++ b/arch/s390/kvm/kvm-s390.h | |||
@@ -142,6 +142,7 @@ void kvm_s390_reinject_io_int(struct kvm *kvm, | |||
142 | int kvm_s390_mask_adapter(struct kvm *kvm, unsigned int id, bool masked); | 142 | int kvm_s390_mask_adapter(struct kvm *kvm, unsigned int id, bool masked); |
143 | 143 | ||
144 | /* implemented in priv.c */ | 144 | /* implemented in priv.c */ |
145 | int is_valid_psw(psw_t *psw); | ||
145 | int kvm_s390_handle_b2(struct kvm_vcpu *vcpu); | 146 | int kvm_s390_handle_b2(struct kvm_vcpu *vcpu); |
146 | int kvm_s390_handle_e5(struct kvm_vcpu *vcpu); | 147 | int kvm_s390_handle_e5(struct kvm_vcpu *vcpu); |
147 | int kvm_s390_handle_01(struct kvm_vcpu *vcpu); | 148 | int kvm_s390_handle_01(struct kvm_vcpu *vcpu); |
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c index 07d0c1025cb9..d99f5f0305a0 100644 --- a/arch/s390/kvm/priv.c +++ b/arch/s390/kvm/priv.c | |||
@@ -365,7 +365,8 @@ static void handle_new_psw(struct kvm_vcpu *vcpu) | |||
365 | #define PSW_ADDR_24 0x0000000000ffffffUL | 365 | #define PSW_ADDR_24 0x0000000000ffffffUL |
366 | #define PSW_ADDR_31 0x000000007fffffffUL | 366 | #define PSW_ADDR_31 0x000000007fffffffUL |
367 | 367 | ||
368 | static int is_valid_psw(psw_t *psw) { | 368 | int is_valid_psw(psw_t *psw) |
369 | { | ||
369 | if (psw->mask & PSW_MASK_UNASSIGNED) | 370 | if (psw->mask & PSW_MASK_UNASSIGNED) |
370 | return 0; | 371 | return 0; |
371 | if ((psw->mask & PSW_MASK_ADDR_MODE) == PSW_MASK_BA) { | 372 | if ((psw->mask & PSW_MASK_ADDR_MODE) == PSW_MASK_BA) { |
@@ -376,6 +377,8 @@ static int is_valid_psw(psw_t *psw) { | |||
376 | return 0; | 377 | return 0; |
377 | if ((psw->mask & PSW_MASK_ADDR_MODE) == PSW_MASK_EA) | 378 | if ((psw->mask & PSW_MASK_ADDR_MODE) == PSW_MASK_EA) |
378 | return 0; | 379 | return 0; |
380 | if (psw->addr & 1) | ||
381 | return 0; | ||
379 | return 1; | 382 | return 1; |
380 | } | 383 | } |
381 | 384 | ||