ui/gtk: move struct GtkDisplayState to ui/gtk.h
[qemu/ar7.git] / tests / plugin / syscall.c
blob53ee2ab6c47149739b00a4f1cb7c22e4aae5235d
1 /*
2 * Copyright (C) 2020, Matthias Weckbecker <matthias@weckbecker.name>
4 * License: GNU GPL, version 2 or later.
5 * See the COPYING file in the top-level directory.
6 */
7 #include <inttypes.h>
8 #include <assert.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <unistd.h>
12 #include <stdio.h>
13 #include <glib.h>
15 #include <qemu-plugin.h>
17 QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION;
19 static void vcpu_syscall(qemu_plugin_id_t id, unsigned int vcpu_index,
20 int64_t num, uint64_t a1, uint64_t a2,
21 uint64_t a3, uint64_t a4, uint64_t a5,
22 uint64_t a6, uint64_t a7, uint64_t a8)
24 g_autofree gchar *out = g_strdup_printf("syscall #%" PRIi64 "\n", num);
25 qemu_plugin_outs(out);
28 static void vcpu_syscall_ret(qemu_plugin_id_t id, unsigned int vcpu_idx,
29 int64_t num, int64_t ret)
31 g_autofree gchar *out;
32 out = g_strdup_printf("syscall #%" PRIi64 " returned -> %" PRIi64 "\n",
33 num, ret);
34 qemu_plugin_outs(out);
37 /* ************************************************************************* */
39 static void plugin_exit(qemu_plugin_id_t id, void *p) {}
41 QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
42 const qemu_info_t *info,
43 int argc, char **argv)
45 qemu_plugin_register_vcpu_syscall_cb(id, vcpu_syscall);
46 qemu_plugin_register_vcpu_syscall_ret_cb(id, vcpu_syscall_ret);
47 qemu_plugin_register_atexit_cb(id, plugin_exit, NULL);
48 return 0;