[PULL,1/6] s390/kvm: Add check for priviledged SCLP handler

Submitted by Christian Borntraeger on Sept. 3, 2013, 7:58 a.m.

Details

Message ID 1378195117-60980-2-git-send-email-borntraeger@de.ibm.com
State New
Headers show

Commit Message

Christian Borntraeger Sept. 3, 2013, 7:58 a.m.
From: Thomas Huth <thuth@linux.vnet.ibm.com>

The SCLP instruction is priviledged, so we should make sure that
we generate an exception when it is called from the problem state.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 target-s390x/kvm.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 185c8f5..dc1ed56 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -448,6 +448,10 @@  static int kvm_sclp_service_call(S390CPU *cpu, struct kvm_run *run,
     int r = 0;
 
     cpu_synchronize_state(CPU(cpu));
+    if (env->psw.mask & PSW_MASK_PSTATE) {
+        enter_pgmcheck(cpu, PGM_PRIVILEGED);
+        return 0;
+    }
     sccb = env->regs[ipbh0 & 0xf];
     code = env->regs[(ipbh0 & 0xf0) >> 4];