]> git.proxmox.com Git - mirror_qemu.git/blame - hw/s390x/s390-virtio-hcall.c
migration/postcopy: mis->have_listen_thread check will never be touched
[mirror_qemu.git] / hw / s390x / s390-virtio-hcall.c
CommitLineData
28e942f8
CH
1/*
2 * Support for virtio hypercalls on s390
3 *
4 * Copyright 2012 IBM Corp.
5 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
6 *
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
9 * directory.
10 */
11
9615495a 12#include "qemu/osdep.h"
28e942f8 13#include "cpu.h"
7d577546 14#include "hw/s390x/s390-virtio-hcall.h"
28e942f8
CH
15
16#define MAX_DIAG_SUBCODES 255
17
18static s390_virtio_fn s390_diag500_table[MAX_DIAG_SUBCODES];
19
20void s390_register_virtio_hypercall(uint64_t code, s390_virtio_fn fn)
21{
22 assert(code < MAX_DIAG_SUBCODES);
23 assert(!s390_diag500_table[code]);
24
25 s390_diag500_table[code] = fn;
26}
27
28int s390_virtio_hypercall(CPUS390XState *env)
29{
f2c55d17 30 s390_virtio_fn fn;
28e942f8 31
f2c55d17
TH
32 if (env->regs[1] < MAX_DIAG_SUBCODES) {
33 fn = s390_diag500_table[env->regs[1]];
34 if (fn) {
77319f22
TH
35 env->regs[2] = fn(&env->regs[2]);
36 return 0;
f2c55d17 37 }
28e942f8
CH
38 }
39
f2c55d17 40 return -EINVAL;
28e942f8 41}