]> git.ipfire.org Git - thirdparty/qemu.git/blame - include/exec/plugin-gen.h
.travis.yml: don't run make check with multiple jobs
[thirdparty/qemu.git] / include / exec / plugin-gen.h
CommitLineData
38b47b19
EC
1/*
2 * Copyright (C) 2017, Emilio G. Cota <cota@braap.org>
3 *
4 * License: GNU GPL, version 2 or later.
5 * See the COPYING file in the top-level directory.
6 *
7 * plugin-gen.h - TCG-dependent definitions for generating plugin code
8 *
9 * This header should be included only from plugin.c and C files that emit
10 * TCG code.
11 */
12#ifndef QEMU_PLUGIN_GEN_H
13#define QEMU_PLUGIN_GEN_H
14
15#include "qemu/plugin.h"
16#include "tcg/tcg.h"
17
18struct DisasContextBase;
19
20#ifdef CONFIG_PLUGIN
21
22bool plugin_gen_tb_start(CPUState *cpu, const TranslationBlock *tb);
23void plugin_gen_tb_end(CPUState *cpu);
24void plugin_gen_insn_start(CPUState *cpu, const struct DisasContextBase *db);
25void plugin_gen_insn_end(void);
26
27void plugin_gen_disable_mem_helpers(void);
28void plugin_gen_empty_mem_callback(TCGv addr, uint32_t info);
29
763f7e12
EC
30static inline void plugin_insn_append(const void *from, size_t size)
31{
32 struct qemu_plugin_insn *insn = tcg_ctx->plugin_insn;
33
34 if (insn == NULL) {
35 return;
36 }
37
38 insn->data = g_byte_array_append(insn->data, from, size);
39}
40
38b47b19
EC
41#else /* !CONFIG_PLUGIN */
42
43static inline
44bool plugin_gen_tb_start(CPUState *cpu, const TranslationBlock *tb)
45{
46 return false;
47}
48
49static inline
50void plugin_gen_insn_start(CPUState *cpu, const struct DisasContextBase *db)
51{ }
52
53static inline void plugin_gen_insn_end(void)
54{ }
55
56static inline void plugin_gen_tb_end(CPUState *cpu)
57{ }
58
59static inline void plugin_gen_disable_mem_helpers(void)
60{ }
61
62static inline void plugin_gen_empty_mem_callback(TCGv addr, uint32_t info)
63{ }
64
763f7e12
EC
65static inline void plugin_insn_append(const void *from, size_t size)
66{ }
67
38b47b19
EC
68#endif /* CONFIG_PLUGIN */
69
70#endif /* QEMU_PLUGIN_GEN_H */
71