]> Git Repo - qemu.git/blobdiff - hw/s390x/s390-virtio-hcall.c
s390x/cpumodel: add esop/esop2 to z12 model
[qemu.git] / hw / s390x / s390-virtio-hcall.c
index d7938c07347a9ded3afa441646e8d02a29711707..23d67d61704423f241134606b2eae83d73324438 100644 (file)
@@ -9,8 +9,9 @@
  * directory.
  */
 
+#include "qemu/osdep.h"
 #include "cpu.h"
-#include "hw/s390-virtio.h"
+#include "hw/s390x/s390-virtio.h"
 
 #define MAX_DIAG_SUBCODES 255
 
@@ -26,11 +27,15 @@ void s390_register_virtio_hypercall(uint64_t code, s390_virtio_fn fn)
 
 int s390_virtio_hypercall(CPUS390XState *env)
 {
-    s390_virtio_fn fn = s390_diag500_table[env->regs[1]];
-
-    if (!fn) {
-        return -EINVAL;
+    s390_virtio_fn fn;
+
+    if (env->regs[1] < MAX_DIAG_SUBCODES) {
+        fn = s390_diag500_table[env->regs[1]];
+        if (fn) {
+            env->regs[2] = fn(&env->regs[2]);
+            return 0;
+        }
     }
 
-    return fn(&env->regs[2]);
+    return -EINVAL;
 }
This page took 0.021439 seconds and 4 git commands to generate.