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