diff options
author | Timos Ampelikiotis <t.ampelikiotis@virtualopensystems.com> | 2023-10-10 11:40:56 +0000 |
---|---|---|
committer | Timos Ampelikiotis <t.ampelikiotis@virtualopensystems.com> | 2023-10-10 11:40:56 +0000 |
commit | e02cda008591317b1625707ff8e115a4841aa889 (patch) | |
tree | aee302e3cf8b59ec2d32ec481be3d1afddfc8968 /stubs | |
parent | cc668e6b7e0ffd8c9d130513d12053cf5eda1d3b (diff) |
Introduce Virtio-loopback epsilon release:
Epsilon release introduces a new compatibility layer which make virtio-loopback
design to work with QEMU and rust-vmm vhost-user backend without require any
changes.
Signed-off-by: Timos Ampelikiotis <t.ampelikiotis@virtualopensystems.com>
Change-Id: I52e57563e08a7d0bdc002f8e928ee61ba0c53dd9
Diffstat (limited to 'stubs')
50 files changed, 1019 insertions, 0 deletions
diff --git a/stubs/bdrv-next-monitor-owned.c b/stubs/bdrv-next-monitor-owned.c new file mode 100644 index 000000000..e62c28986 --- /dev/null +++ b/stubs/bdrv-next-monitor-owned.c @@ -0,0 +1,7 @@ +#include "qemu/osdep.h" +#include "block/block.h" + +BlockDriverState *bdrv_next_monitor_owned(BlockDriverState *bs) +{ + return NULL; +} diff --git a/stubs/blk-commit-all.c b/stubs/blk-commit-all.c new file mode 100644 index 000000000..e156c57f8 --- /dev/null +++ b/stubs/blk-commit-all.c @@ -0,0 +1,7 @@ +#include "qemu/osdep.h" +#include "sysemu/block-backend.h" + +int blk_commit_all(void) +{ + return 0; +} diff --git a/stubs/blk-exp-close-all.c b/stubs/blk-exp-close-all.c new file mode 100644 index 000000000..1c7131676 --- /dev/null +++ b/stubs/blk-exp-close-all.c @@ -0,0 +1,7 @@ +#include "qemu/osdep.h" +#include "block/export.h" + +/* Only used in programs that support block exports (libblockdev.fa) */ +void blk_exp_close_all(void) +{ +} diff --git a/stubs/blockdev-close-all-bdrv-states.c b/stubs/blockdev-close-all-bdrv-states.c new file mode 100644 index 000000000..f1f1d9cdc --- /dev/null +++ b/stubs/blockdev-close-all-bdrv-states.c @@ -0,0 +1,6 @@ +#include "qemu/osdep.h" +#include "block/block_int.h" + +void blockdev_close_all_bdrv_states(void) +{ +} diff --git a/stubs/change-state-handler.c b/stubs/change-state-handler.c new file mode 100644 index 000000000..d1ed46bfb --- /dev/null +++ b/stubs/change-state-handler.c @@ -0,0 +1,13 @@ +#include "qemu/osdep.h" +#include "sysemu/runstate.h" + +VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb, + void *opaque) +{ + return NULL; +} + +void qemu_del_vm_change_state_handler(VMChangeStateEntry *e) +{ + /* Nothing to do. */ +} diff --git a/stubs/cmos.c b/stubs/cmos.c new file mode 100644 index 000000000..3fdbae2c6 --- /dev/null +++ b/stubs/cmos.c @@ -0,0 +1,7 @@ +#include "qemu/osdep.h" +#include "hw/block/fdc.h" + +int cmos_get_fd_drive_type(FloppyDriveType fd0) +{ + return 0; +} diff --git a/stubs/cpu-get-clock.c b/stubs/cpu-get-clock.c new file mode 100644 index 000000000..9e9240481 --- /dev/null +++ b/stubs/cpu-get-clock.c @@ -0,0 +1,8 @@ +#include "qemu/osdep.h" +#include "sysemu/cpu-timers.h" +#include "qemu/main-loop.h" + +int64_t cpu_get_clock(void) +{ + return get_clock_realtime(); +} diff --git a/stubs/cpu-synchronize-state.c b/stubs/cpu-synchronize-state.c new file mode 100644 index 000000000..d9211da66 --- /dev/null +++ b/stubs/cpu-synchronize-state.c @@ -0,0 +1,9 @@ +#include "qemu/osdep.h" +#include "sysemu/hw_accel.h" + +void cpu_synchronize_state(CPUState *cpu) +{ +} +void cpu_synchronize_post_init(CPUState *cpu) +{ +} diff --git a/stubs/cpus-get-virtual-clock.c b/stubs/cpus-get-virtual-clock.c new file mode 100644 index 000000000..fd447d53f --- /dev/null +++ b/stubs/cpus-get-virtual-clock.c @@ -0,0 +1,8 @@ +#include "qemu/osdep.h" +#include "sysemu/cpu-timers.h" +#include "qemu/main-loop.h" + +int64_t cpus_get_virtual_clock(void) +{ + return cpu_get_clock(); +} diff --git a/stubs/dump.c b/stubs/dump.c new file mode 100644 index 000000000..1f28ec2be --- /dev/null +++ b/stubs/dump.c @@ -0,0 +1,27 @@ +/* + * QEMU dump + * + * Copyright Fujitsu, Corp. 2011, 2012 + * + * Authors: + * Wen Congyang <wency@cn.fujitsu.com> + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "sysemu/dump-arch.h" + +int cpu_get_dump_info(ArchDumpInfo *info, + const struct GuestPhysBlockList *guest_phys_blocks) +{ + return -1; +} + +ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) +{ + return -1; +} + diff --git a/stubs/error-printf.c b/stubs/error-printf.c new file mode 100644 index 000000000..a2f61521a --- /dev/null +++ b/stubs/error-printf.c @@ -0,0 +1,22 @@ +#include "qemu/osdep.h" +#include "qemu/error-report.h" + +int error_vprintf(const char *fmt, va_list ap) +{ + int ret; + + if (g_test_initialized() && !g_test_subprocess() && + getenv("QTEST_SILENT_ERRORS")) { + char *msg = g_strdup_vprintf(fmt, ap); + g_test_message("%s", msg); + ret = strlen(msg); + g_free(msg); + return ret; + } + return vfprintf(stderr, fmt, ap); +} + +int error_vprintf_unless_qmp(const char *fmt, va_list ap) +{ + return error_vprintf(fmt, ap); +} diff --git a/stubs/fdset.c b/stubs/fdset.c new file mode 100644 index 000000000..56b3663d5 --- /dev/null +++ b/stubs/fdset.c @@ -0,0 +1,17 @@ +#include "qemu/osdep.h" +#include "monitor/monitor.h" + +int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags) +{ + errno = ENOSYS; + return -1; +} + +int64_t monitor_fdset_dup_fd_find(int dup_fd) +{ + return -1; +} + +void monitor_fdset_dup_fd_remove(int dupfd) +{ +} diff --git a/stubs/fw_cfg.c b/stubs/fw_cfg.c new file mode 100644 index 000000000..bb1e3c8aa --- /dev/null +++ b/stubs/fw_cfg.c @@ -0,0 +1,21 @@ +/* + * fw_cfg stubs + * + * Copyright (c) 2019 Red Hat, Inc. + * + * Author: + * Philippe Mathieu-Daudé <philmd@redhat.com> + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hw/nvram/fw_cfg.h" + +const char *fw_cfg_arch_key_name(uint16_t key) +{ + return NULL; +} diff --git a/stubs/gdbstub.c b/stubs/gdbstub.c new file mode 100644 index 000000000..2b7aee50d --- /dev/null +++ b/stubs/gdbstub.c @@ -0,0 +1,6 @@ +#include "qemu/osdep.h" +#include "exec/gdbstub.h" /* xml_builtin */ + +const char *const xml_builtin[][2] = { + { NULL, NULL } +}; diff --git a/stubs/get-vm-name.c b/stubs/get-vm-name.c new file mode 100644 index 000000000..fa990136b --- /dev/null +++ b/stubs/get-vm-name.c @@ -0,0 +1,8 @@ +#include "qemu/osdep.h" +#include "qemu-common.h" + +const char *qemu_get_vm_name(void) +{ + return NULL; +} + diff --git a/stubs/icount.c b/stubs/icount.c new file mode 100644 index 000000000..f13c43568 --- /dev/null +++ b/stubs/icount.c @@ -0,0 +1,45 @@ +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "sysemu/cpu-timers.h" + +/* icount - Instruction Counter API */ + +int use_icount; + +void icount_update(CPUState *cpu) +{ + abort(); +} +void icount_configure(QemuOpts *opts, Error **errp) +{ + /* signal error */ + error_setg(errp, "cannot configure icount, TCG support not available"); +} +int64_t icount_get_raw(void) +{ + abort(); + return 0; +} +int64_t icount_get(void) +{ + abort(); + return 0; +} +int64_t icount_to_ns(int64_t icount) +{ + abort(); + return 0; +} +int64_t icount_round(int64_t count) +{ + abort(); + return 0; +} +void icount_start_warp_timer(void) +{ + abort(); +} +void icount_account_warp_timer(void) +{ + abort(); +} diff --git a/stubs/io_uring.c b/stubs/io_uring.c new file mode 100644 index 000000000..622d1e464 --- /dev/null +++ b/stubs/io_uring.c @@ -0,0 +1,32 @@ +/* + * Linux io_uring support. + * + * Copyright (C) 2009 IBM, Corp. + * Copyright (C) 2009 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ +#include "qemu/osdep.h" +#include "block/aio.h" +#include "block/raw-aio.h" + +void luring_detach_aio_context(LuringState *s, AioContext *old_context) +{ + abort(); +} + +void luring_attach_aio_context(LuringState *s, AioContext *new_context) +{ + abort(); +} + +LuringState *luring_init(Error **errp) +{ + abort(); +} + +void luring_cleanup(LuringState *s) +{ + abort(); +} diff --git a/stubs/iothread-lock.c b/stubs/iothread-lock.c new file mode 100644 index 000000000..5b45b7fc8 --- /dev/null +++ b/stubs/iothread-lock.c @@ -0,0 +1,15 @@ +#include "qemu/osdep.h" +#include "qemu/main-loop.h" + +bool qemu_mutex_iothread_locked(void) +{ + return false; +} + +void qemu_mutex_lock_iothread_impl(const char *file, int line) +{ +} + +void qemu_mutex_unlock_iothread(void) +{ +} diff --git a/stubs/is-daemonized.c b/stubs/is-daemonized.c new file mode 100644 index 000000000..8f63325bb --- /dev/null +++ b/stubs/is-daemonized.c @@ -0,0 +1,9 @@ +#include "qemu/osdep.h" + +/* Win32 has its own inline stub */ +#ifndef _WIN32 +bool is_daemonized(void) +{ + return false; +} +#endif diff --git a/stubs/isa-bus.c b/stubs/isa-bus.c new file mode 100644 index 000000000..522f44899 --- /dev/null +++ b/stubs/isa-bus.c @@ -0,0 +1,7 @@ +#include "qemu/osdep.h" +#include "hw/isa/isa.h" + +ISADevice *isa_create_simple(ISABus *bus, const char *name) +{ + g_assert_not_reached(); +} diff --git a/stubs/linux-aio.c b/stubs/linux-aio.c new file mode 100644 index 000000000..84d1f784a --- /dev/null +++ b/stubs/linux-aio.c @@ -0,0 +1,32 @@ +/* + * Linux native AIO support. + * + * Copyright (C) 2009 IBM, Corp. + * Copyright (C) 2009 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ +#include "qemu/osdep.h" +#include "block/aio.h" +#include "block/raw-aio.h" + +void laio_detach_aio_context(LinuxAioState *s, AioContext *old_context) +{ + abort(); +} + +void laio_attach_aio_context(LinuxAioState *s, AioContext *new_context) +{ + abort(); +} + +LinuxAioState *laio_init(Error **errp) +{ + abort(); +} + +void laio_cleanup(LinuxAioState *s) +{ + abort(); +} diff --git a/stubs/meson.build b/stubs/meson.build new file mode 100644 index 000000000..71469c1d5 --- /dev/null +++ b/stubs/meson.build @@ -0,0 +1,59 @@ +stub_ss.add(files('bdrv-next-monitor-owned.c')) +stub_ss.add(files('blk-commit-all.c')) +stub_ss.add(files('blk-exp-close-all.c')) +stub_ss.add(files('blockdev-close-all-bdrv-states.c')) +stub_ss.add(files('change-state-handler.c')) +stub_ss.add(files('cmos.c')) +stub_ss.add(files('cpu-get-clock.c')) +stub_ss.add(files('cpus-get-virtual-clock.c')) +stub_ss.add(files('qemu-timer-notify-cb.c')) +stub_ss.add(files('icount.c')) +stub_ss.add(files('dump.c')) +stub_ss.add(files('error-printf.c')) +stub_ss.add(files('fdset.c')) +stub_ss.add(files('fw_cfg.c')) +stub_ss.add(files('gdbstub.c')) +stub_ss.add(files('get-vm-name.c')) +if linux_io_uring.found() + stub_ss.add(files('io_uring.c')) +endif +stub_ss.add(files('iothread-lock.c')) +stub_ss.add(files('isa-bus.c')) +stub_ss.add(files('is-daemonized.c')) +if libaio.found() + stub_ss.add(files('linux-aio.c')) +endif +stub_ss.add(files('migr-blocker.c')) +stub_ss.add(files('module-opts.c')) +stub_ss.add(files('monitor.c')) +stub_ss.add(files('monitor-core.c')) +stub_ss.add(files('pci-bus.c')) +stub_ss.add(files('qemu-timer-notify-cb.c')) +stub_ss.add(files('qmp_memory_device.c')) +stub_ss.add(files('qmp-command-available.c')) +stub_ss.add(files('qmp-quit.c')) +stub_ss.add(files('qtest.c')) +stub_ss.add(files('ram-block.c')) +stub_ss.add(files('ramfb.c')) +stub_ss.add(files('replay.c')) +stub_ss.add(files('runstate-check.c')) +stub_ss.add(files('sysbus.c')) +stub_ss.add(files('target-get-monitor-def.c')) +stub_ss.add(files('target-monitor-defs.c')) +stub_ss.add(files('trace-control.c')) +stub_ss.add(files('uuid.c')) +stub_ss.add(files('vmgenid.c')) +stub_ss.add(files('vmstate.c')) +stub_ss.add(files('vm-stop.c')) +stub_ss.add(files('win32-kbd-hook.c')) +stub_ss.add(files('cpu-synchronize-state.c')) +if have_block + stub_ss.add(files('replay-tools.c')) +endif +if have_system + stub_ss.add(files('semihost.c')) + stub_ss.add(files('usb-dev-stub.c')) + stub_ss.add(files('xen-hw-stub.c')) +else + stub_ss.add(files('qdev.c')) +endif diff --git a/stubs/migr-blocker.c b/stubs/migr-blocker.c new file mode 100644 index 000000000..5676a2f93 --- /dev/null +++ b/stubs/migr-blocker.c @@ -0,0 +1,11 @@ +#include "qemu/osdep.h" +#include "migration/blocker.h" + +int migrate_add_blocker(Error *reason, Error **errp) +{ + return 0; +} + +void migrate_del_blocker(Error *reason) +{ +} diff --git a/stubs/module-opts.c b/stubs/module-opts.c new file mode 100644 index 000000000..5412429ea --- /dev/null +++ b/stubs/module-opts.c @@ -0,0 +1,2 @@ +#include "qemu/osdep.h" +#include "qemu/config-file.h" diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c new file mode 100644 index 000000000..d058a2a00 --- /dev/null +++ b/stubs/monitor-core.c @@ -0,0 +1,29 @@ +#include "qemu/osdep.h" +#include "monitor/monitor.h" +#include "qemu-common.h" +#include "qapi/qapi-emit-events.h" + +Monitor *monitor_cur(void) +{ + return NULL; +} + +Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) +{ + return NULL; +} + +void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp) +{ +} + +void qapi_event_emit(QAPIEvent event, QDict *qdict) +{ +} + +int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) +{ + abort(); +} + + diff --git a/stubs/monitor.c b/stubs/monitor.c new file mode 100644 index 000000000..20786ac4f --- /dev/null +++ b/stubs/monitor.c @@ -0,0 +1,18 @@ +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "monitor/monitor.h" +#include "../monitor/monitor-internal.h" + +int monitor_get_fd(Monitor *mon, const char *name, Error **errp) +{ + error_setg(errp, "only QEMU supports file descriptor passing"); + return -1; +} + +void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp) +{ +} + +void monitor_fdsets_cleanup(void) +{ +} diff --git a/stubs/pci-bus.c b/stubs/pci-bus.c new file mode 100644 index 000000000..a8932fa93 --- /dev/null +++ b/stubs/pci-bus.c @@ -0,0 +1,7 @@ +#include "qemu/osdep.h" +#include "hw/pci/pci.h" + +PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name) +{ + g_assert_not_reached(); +} diff --git a/stubs/qdev.c b/stubs/qdev.c new file mode 100644 index 000000000..187659f70 --- /dev/null +++ b/stubs/qdev.c @@ -0,0 +1,30 @@ +/* + * QOM stubs + * + * Copyright (c) 2021 Red Hat, Inc. + * + * Author: + * Philippe Mathieu-Daudé <philmd@redhat.com> + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "qapi/qapi-events-qdev.h" + +void qapi_event_send_device_deleted(bool has_device, + const char *device, + const char *path) +{ + /* Nothing to do. */ +} + +void qapi_event_send_device_unplug_guest_error(bool has_device, + const char *device, + const char *path) +{ + /* Nothing to do. */ +} diff --git a/stubs/qemu-timer-notify-cb.c b/stubs/qemu-timer-notify-cb.c new file mode 100644 index 000000000..845e46f8e --- /dev/null +++ b/stubs/qemu-timer-notify-cb.c @@ -0,0 +1,8 @@ +#include "qemu/osdep.h" +#include "sysemu/cpu-timers.h" +#include "qemu/main-loop.h" + +void qemu_timer_notify_cb(void *opaque, QEMUClockType type) +{ + qemu_notify_event(); +} diff --git a/stubs/qmp-command-available.c b/stubs/qmp-command-available.c new file mode 100644 index 000000000..46540af7b --- /dev/null +++ b/stubs/qmp-command-available.c @@ -0,0 +1,7 @@ +#include "qemu/osdep.h" +#include "qapi/qmp/dispatch.h" + +bool qmp_command_available(const QmpCommand *cmd, Error **errp) +{ + return true; +} diff --git a/stubs/qmp-quit.c b/stubs/qmp-quit.c new file mode 100644 index 000000000..a3ff47f7b --- /dev/null +++ b/stubs/qmp-quit.c @@ -0,0 +1,8 @@ +#include "qemu/osdep.h" +#include "qapi/qapi-commands-control.h" +#include "qapi/qmp/dispatch.h" + +void qmp_quit(Error **errp) +{ + g_assert_not_reached(); +} diff --git a/stubs/qmp_memory_device.c b/stubs/qmp_memory_device.c new file mode 100644 index 000000000..e75cac62d --- /dev/null +++ b/stubs/qmp_memory_device.c @@ -0,0 +1,12 @@ +#include "qemu/osdep.h" +#include "hw/mem/memory-device.h" + +MemoryDeviceInfoList *qmp_memory_device_list(void) +{ + return NULL; +} + +uint64_t get_plugged_memory_size(void) +{ + return (uint64_t)-1; +} diff --git a/stubs/qtest.c b/stubs/qtest.c new file mode 100644 index 000000000..4666a49d7 --- /dev/null +++ b/stubs/qtest.c @@ -0,0 +1,25 @@ +/* + * qtest stubs + * + * Copyright (c) 2014 Linaro Limited + * Written by Peter Maydell + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "sysemu/qtest.h" + +/* Needed for qtest_allowed() */ +bool qtest_allowed; + +bool qtest_driver(void) +{ + return false; +} + +int64_t qtest_get_virtual_clock(void) +{ + return 0; +} diff --git a/stubs/ram-block.c b/stubs/ram-block.c new file mode 100644 index 000000000..108197683 --- /dev/null +++ b/stubs/ram-block.c @@ -0,0 +1,37 @@ +#include "qemu/osdep.h" +#include "exec/ramlist.h" +#include "exec/cpu-common.h" +#include "exec/memory.h" + +void *qemu_ram_get_host_addr(RAMBlock *rb) +{ + return 0; +} + +ram_addr_t qemu_ram_get_offset(RAMBlock *rb) +{ + return 0; +} + +ram_addr_t qemu_ram_get_used_length(RAMBlock *rb) +{ + return 0; +} + +void ram_block_notifier_add(RAMBlockNotifier *n) +{ +} + +void ram_block_notifier_remove(RAMBlockNotifier *n) +{ +} + +int qemu_ram_foreach_block(RAMBlockIterFunc func, void *opaque) +{ + return 0; +} + +int ram_block_discard_disable(bool state) +{ + return 0; +} diff --git a/stubs/ramfb.c b/stubs/ramfb.c new file mode 100644 index 000000000..48143f335 --- /dev/null +++ b/stubs/ramfb.c @@ -0,0 +1,13 @@ +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/display/ramfb.h" + +void ramfb_display_update(QemuConsole *con, RAMFBState *s) +{ +} + +RAMFBState *ramfb_setup(Error **errp) +{ + error_setg(errp, "ramfb support not available"); + return NULL; +} diff --git a/stubs/replay-tools.c b/stubs/replay-tools.c new file mode 100644 index 000000000..43296b3d4 --- /dev/null +++ b/stubs/replay-tools.c @@ -0,0 +1,83 @@ +#include "qemu/osdep.h" +#include "sysemu/replay.h" +#include "block/aio.h" + +bool replay_events_enabled(void) +{ + return false; +} + +int64_t replay_save_clock(unsigned int kind, int64_t clock, int64_t raw_icount) +{ + abort(); + return 0; +} + +int64_t replay_read_clock(unsigned int kind, int64_t raw_icount) +{ + abort(); + return 0; +} + +uint64_t replay_get_current_icount(void) +{ + return 0; +} + +void replay_bh_schedule_event(QEMUBH *bh) +{ + qemu_bh_schedule(bh); +} + +void replay_bh_schedule_oneshot_event(AioContext *ctx, + QEMUBHFunc *cb, void *opaque) +{ + aio_bh_schedule_oneshot(ctx, cb, opaque); +} + +bool replay_checkpoint(ReplayCheckpoint checkpoint) +{ + return true; +} + +void replay_mutex_lock(void) +{ +} + +void replay_mutex_unlock(void) +{ +} + +void replay_register_char_driver(Chardev *chr) +{ +} + +void replay_chr_be_write(Chardev *s, uint8_t *buf, int len) +{ + abort(); +} + +void replay_char_write_event_save(int res, int offset) +{ + abort(); +} + +void replay_char_write_event_load(int *res, int *offset) +{ + abort(); +} + +int replay_char_read_all_load(uint8_t *buf) +{ + abort(); +} + +void replay_char_read_all_save_error(int res) +{ + abort(); +} + +void replay_char_read_all_save_buf(uint8_t *buf, int offset) +{ + abort(); +} diff --git a/stubs/replay.c b/stubs/replay.c new file mode 100644 index 000000000..9d5b4be33 --- /dev/null +++ b/stubs/replay.c @@ -0,0 +1,27 @@ +#include "qemu/osdep.h" +#include "sysemu/replay.h" + +ReplayMode replay_mode; + +void replay_finish(void) +{ +} + +void replay_save_random(int ret, void *buf, size_t len) +{ +} + +int replay_read_random(void *buf, size_t len) +{ + return 0; +} + +bool replay_reverse_step(void) +{ + return false; +} + +bool replay_reverse_continue(void) +{ + return false; +} diff --git a/stubs/runstate-check.c b/stubs/runstate-check.c new file mode 100644 index 000000000..2ccda2b70 --- /dev/null +++ b/stubs/runstate-check.c @@ -0,0 +1,7 @@ +#include "qemu/osdep.h" + +#include "sysemu/runstate.h" +bool runstate_check(RunState state) +{ + return state == RUN_STATE_PRELAUNCH; +} diff --git a/stubs/semihost.c b/stubs/semihost.c new file mode 100644 index 000000000..4bf2cf71b --- /dev/null +++ b/stubs/semihost.c @@ -0,0 +1,74 @@ +/* + * Semihosting Stubs for SoftMMU + * + * Copyright (c) 2019 Linaro Ltd + * + * Stubs for SoftMMU targets that don't actually do semihosting. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/option.h" +#include "qemu/error-report.h" +#include "semihosting/semihost.h" + +/* Empty config */ +QemuOptsList qemu_semihosting_config_opts = { + .name = "", + .head = QTAILQ_HEAD_INITIALIZER(qemu_semihosting_config_opts.head), + .desc = { + { /* end of list */ } + }, +}; + +/* Queries to config status default to off */ +bool semihosting_enabled(void) +{ + return false; +} + +SemihostingTarget semihosting_get_target(void) +{ + return SEMIHOSTING_TARGET_AUTO; +} + +/* + * All the rest are empty subs. We could g_assert_not_reached() but + * that adds extra weight to the final binary. Waste not want not. + */ +void qemu_semihosting_enable(void) +{ +} + +int qemu_semihosting_config_options(const char *optarg) +{ + return 1; +} + +const char *semihosting_get_arg(int i) +{ + return NULL; +} + +int semihosting_get_argc(void) +{ + return 0; +} + +const char *semihosting_get_cmdline(void) +{ + return NULL; +} + +void semihosting_arg_fallback(const char *file, const char *cmd) +{ +} + +void qemu_semihosting_connect_chardevs(void) +{ +} + +void qemu_semihosting_console_init(void) +{ +} diff --git a/stubs/sysbus.c b/stubs/sysbus.c new file mode 100644 index 000000000..d8da90caa --- /dev/null +++ b/stubs/sysbus.c @@ -0,0 +1,7 @@ +#include "qemu/osdep.h" +#include "hw/qdev-core.h" + +BusState *sysbus_get_default(void) +{ + return NULL; +} diff --git a/stubs/target-get-monitor-def.c b/stubs/target-get-monitor-def.c new file mode 100644 index 000000000..394e0f9a7 --- /dev/null +++ b/stubs/target-get-monitor-def.c @@ -0,0 +1,29 @@ +/* + * Stub for target_get_monitor_def. + * + * Copyright IBM Corp., 2015 + * + * Author: Alexey Kardashevskiy <aik@ozlabs.ru> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#include "qemu/osdep.h" + +int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval); + +int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval) +{ + return -1; +} diff --git a/stubs/target-monitor-defs.c b/stubs/target-monitor-defs.c new file mode 100644 index 000000000..ac07b1906 --- /dev/null +++ b/stubs/target-monitor-defs.c @@ -0,0 +1,8 @@ +#include "qemu/osdep.h" + +const MonitorDef *target_monitor_defs(void); + +const MonitorDef *target_monitor_defs(void) +{ + return NULL; +} diff --git a/stubs/trace-control.c b/stubs/trace-control.c new file mode 100644 index 000000000..7f856e5c2 --- /dev/null +++ b/stubs/trace-control.c @@ -0,0 +1,51 @@ +/* + * Interface for configuring and controlling the state of tracing events. + * + * Copyright (C) 2014-2016 Lluís Vilanova <vilanova@ac.upc.edu> + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "trace/control.h" + + +void trace_event_set_state_dynamic_init(TraceEvent *ev, bool state) +{ + trace_event_set_state_dynamic(ev, state); +} + +void trace_event_set_state_dynamic(TraceEvent *ev, bool state) +{ + bool state_pre; + assert(trace_event_get_state_static(ev)); + + /* + * We ignore the "vcpu" property here, since there's no target code. Then + * dstate can only be 1 or 0. + */ + state_pre = *(ev->dstate); + if (state_pre != state) { + if (state) { + trace_events_enabled_count++; + *(ev->dstate) = 1; + } else { + trace_events_enabled_count--; + *(ev->dstate) = 0; + } + } +} + +void trace_event_set_vcpu_state_dynamic(CPUState *vcpu, + TraceEvent *ev, bool state) +{ + /* should never be called on non-target binaries */ + abort(); +} + +void trace_init_vcpu(CPUState *vcpu) +{ + /* should never be called on non-target binaries */ + abort(); +} diff --git a/stubs/usb-dev-stub.c b/stubs/usb-dev-stub.c new file mode 100644 index 000000000..aa557692b --- /dev/null +++ b/stubs/usb-dev-stub.c @@ -0,0 +1,33 @@ +/* + * QEMU USB device emulation stubs + * + * Copyright (C) 2021 Philippe Mathieu-Daudé <f4bug@amsat.org> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-machine.h" +#include "sysemu/sysemu.h" +#include "monitor/monitor.h" +#include "hw/usb.h" + +USBDevice *usbdevice_create(const char *driver) +{ + error_report("Support for USB devices not built-in"); + + return NULL; +} + +HumanReadableText *qmp_x_query_usb(Error **errp) +{ + error_setg(errp, "Support for USB devices not built-in"); + return NULL; +} + +void hmp_info_usb(Monitor *mon, const QDict *qdict) +{ + monitor_printf(mon, "Support for USB devices not built-in\n"); +} diff --git a/stubs/uuid.c b/stubs/uuid.c new file mode 100644 index 000000000..e5112eb3f --- /dev/null +++ b/stubs/uuid.c @@ -0,0 +1,12 @@ +#include "qemu/osdep.h" +#include "qapi/qapi-commands-machine.h" +#include "qemu/uuid.h" + +UuidInfo *qmp_query_uuid(Error **errp) +{ + UuidInfo *info = g_malloc0(sizeof(*info)); + + info->UUID = g_strdup(UUID_NONE); + return info; +} + diff --git a/stubs/vm-stop.c b/stubs/vm-stop.c new file mode 100644 index 000000000..7f8a9da8a --- /dev/null +++ b/stubs/vm-stop.c @@ -0,0 +1,12 @@ +#include "qemu/osdep.h" + +#include "sysemu/runstate.h" +void qemu_system_vmstop_request_prepare(void) +{ + abort(); +} + +void qemu_system_vmstop_request(RunState state) +{ + abort(); +} diff --git a/stubs/vmgenid.c b/stubs/vmgenid.c new file mode 100644 index 000000000..bfad656c6 --- /dev/null +++ b/stubs/vmgenid.c @@ -0,0 +1,10 @@ +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-machine.h" +#include "qapi/qmp/qerror.h" + +GuidInfo *qmp_query_vm_generation_id(Error **errp) +{ + error_setg(errp, QERR_UNSUPPORTED); + return NULL; +} diff --git a/stubs/vmstate.c b/stubs/vmstate.c new file mode 100644 index 000000000..8513d9204 --- /dev/null +++ b/stubs/vmstate.c @@ -0,0 +1,23 @@ +#include "qemu/osdep.h" +#include "migration/vmstate.h" + +int vmstate_register_with_alias_id(VMStateIf *obj, + uint32_t instance_id, + const VMStateDescription *vmsd, + void *base, int alias_id, + int required_for_version, + Error **errp) +{ + return 0; +} + +void vmstate_unregister(VMStateIf *obj, + const VMStateDescription *vmsd, + void *opaque) +{ +} + +bool vmstate_check_only_migratable(const VMStateDescription *vmsd) +{ + return true; +} diff --git a/stubs/win32-kbd-hook.c b/stubs/win32-kbd-hook.c new file mode 100644 index 000000000..1a084b081 --- /dev/null +++ b/stubs/win32-kbd-hook.c @@ -0,0 +1,18 @@ +/* + * Win32 keyboard hook stubs + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. See the COPYING file in the + * top-level directory. + */ + +#include "qemu/osdep.h" +#include "ui/win32-kbd-hook.h" + +void win32_kbd_set_window(void *hwnd) +{ +} + +void win32_kbd_set_grab(bool grab) +{ +} diff --git a/stubs/xen-hw-stub.c b/stubs/xen-hw-stub.c new file mode 100644 index 000000000..15f3921a7 --- /dev/null +++ b/stubs/xen-hw-stub.c @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2014 Citrix Systems UK Ltd. + * + * SPDX-License-Identifier: GPL-2.0-or-later + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hw/xen/xen.h" +#include "hw/xen/xen-x86.h" + +int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num) +{ + return -1; +} + +void xen_piix3_set_irq(void *opaque, int irq_num, int level) +{ +} + +void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len) +{ +} + +void xen_hvm_inject_msi(uint64_t addr, uint32_t data) +{ +} + +int xen_is_pirq_msi(uint32_t msi_data) +{ + return 0; +} + +qemu_irq *xen_interrupt_controller_init(void) +{ + return NULL; +} + +void xen_register_framebuffer(MemoryRegion *mr) +{ +} + +void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory) +{ +} |