2 * Support for virtio hypercalls on s390
4 * Copyright 2012 IBM Corp.
7 * This work is licensed under the terms of the GNU GPL, version 2 or (at
8 * your option) any later version. See the COPYING file in the top-level
13 #include "hw/s390x/s390-virtio.h"
15 #define MAX_DIAG_SUBCODES 255
17 static s390_virtio_fn s390_diag500_table[MAX_DIAG_SUBCODES];
19 void s390_register_virtio_hypercall(uint64_t code, s390_virtio_fn fn)
21 assert(code < MAX_DIAG_SUBCODES);
22 assert(!s390_diag500_table[code]);
24 s390_diag500_table[code] = fn;
27 int s390_virtio_hypercall(CPUS390XState *env)
29 s390_virtio_fn fn = s390_diag500_table[env->regs[1]];
35 return fn(&env->regs[2]);