s390/kvm: Add check for priviledged SCLP handler
authorThomas Huth <thuth@linux.vnet.ibm.com>
Mon, 29 Jul 2013 13:49:16 +0000 (15:49 +0200)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Fri, 20 Sep 2013 10:46:52 +0000 (12:46 +0200)
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

index 4923e0a71752e306321408d38f8cbb5d02ff13a1..0bc317e928d59eab67b0498de28e43975407cab2 100644 (file)
@@ -439,6 +439,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];