xref: /openbmc/qemu/include/exec/plugin-gen.h (revision 30865f316856cc346f4af7ec28586c4a636b0109)
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 
18 struct DisasContextBase;
19 
20 #ifdef CONFIG_PLUGIN
21 
22 bool plugin_gen_tb_start(CPUState *cpu, const TranslationBlock *tb);
23 void plugin_gen_tb_end(CPUState *cpu);
24 void plugin_gen_insn_start(CPUState *cpu, const struct DisasContextBase *db);
25 void plugin_gen_insn_end(void);
26 
27 void plugin_gen_disable_mem_helpers(void);
28 void plugin_gen_empty_mem_callback(TCGv addr, uint32_t info);
29 
30 #else /* !CONFIG_PLUGIN */
31 
32 static inline
33 bool plugin_gen_tb_start(CPUState *cpu, const TranslationBlock *tb)
34 {
35     return false;
36 }
37 
38 static inline
39 void plugin_gen_insn_start(CPUState *cpu, const struct DisasContextBase *db)
40 { }
41 
42 static inline void plugin_gen_insn_end(void)
43 { }
44 
45 static inline void plugin_gen_tb_end(CPUState *cpu)
46 { }
47 
48 static inline void plugin_gen_disable_mem_helpers(void)
49 { }
50 
51 static inline void plugin_gen_empty_mem_callback(TCGv addr, uint32_t info)
52 { }
53 
54 #endif /* CONFIG_PLUGIN */
55 
56 #endif /* QEMU_PLUGIN_GEN_H */
57 
58