xref: /qemu/include/exec/plugin-gen.h (revision a392277dcf00e7bf6f7a0ecc9075ea154532c436)
138b47b19SEmilio G. Cota /*
238b47b19SEmilio G. Cota  * Copyright (C) 2017, Emilio G. Cota <cota@braap.org>
338b47b19SEmilio G. Cota  *
438b47b19SEmilio G. Cota  * License: GNU GPL, version 2 or later.
538b47b19SEmilio G. Cota  *   See the COPYING file in the top-level directory.
638b47b19SEmilio G. Cota  *
738b47b19SEmilio G. Cota  * plugin-gen.h - TCG-dependent definitions for generating plugin code
838b47b19SEmilio G. Cota  *
938b47b19SEmilio G. Cota  * This header should be included only from plugin.c and C files that emit
1038b47b19SEmilio G. Cota  * TCG code.
1138b47b19SEmilio G. Cota  */
1238b47b19SEmilio G. Cota #ifndef QEMU_PLUGIN_GEN_H
1338b47b19SEmilio G. Cota #define QEMU_PLUGIN_GEN_H
1438b47b19SEmilio G. Cota 
1538b47b19SEmilio G. Cota #include "tcg/tcg.h"
1638b47b19SEmilio G. Cota 
1738b47b19SEmilio G. Cota struct DisasContextBase;
1838b47b19SEmilio G. Cota 
1938b47b19SEmilio G. Cota #ifdef CONFIG_PLUGIN
2038b47b19SEmilio G. Cota 
21b21af662SRichard Henderson bool plugin_gen_tb_start(CPUState *cpu, const struct DisasContextBase *db,
22b21af662SRichard Henderson                          bool supress);
23*a392277dSMatt Borgerson void plugin_gen_tb_end(CPUState *cpu, size_t num_insns);
2438b47b19SEmilio G. Cota void plugin_gen_insn_start(CPUState *cpu, const struct DisasContextBase *db);
2538b47b19SEmilio G. Cota void plugin_gen_insn_end(void);
2638b47b19SEmilio G. Cota 
2738b47b19SEmilio G. Cota void plugin_gen_disable_mem_helpers(void);
28fcdab382SRichard Henderson void plugin_gen_empty_mem_callback(TCGv_i64 addr, uint32_t info);
2938b47b19SEmilio G. Cota 
3038b47b19SEmilio G. Cota #else /* !CONFIG_PLUGIN */
3138b47b19SEmilio G. Cota 
32b21af662SRichard Henderson static inline bool
33b21af662SRichard Henderson plugin_gen_tb_start(CPUState *cpu, const struct DisasContextBase *db, bool sup)
3438b47b19SEmilio G. Cota {
3538b47b19SEmilio G. Cota     return false;
3638b47b19SEmilio G. Cota }
3738b47b19SEmilio G. Cota 
3838b47b19SEmilio G. Cota static inline
3938b47b19SEmilio G. Cota void plugin_gen_insn_start(CPUState *cpu, const struct DisasContextBase *db)
4038b47b19SEmilio G. Cota { }
4138b47b19SEmilio G. Cota 
4238b47b19SEmilio G. Cota static inline void plugin_gen_insn_end(void)
4338b47b19SEmilio G. Cota { }
4438b47b19SEmilio G. Cota 
45*a392277dSMatt Borgerson static inline void plugin_gen_tb_end(CPUState *cpu, size_t num_insns)
4638b47b19SEmilio G. Cota { }
4738b47b19SEmilio G. Cota 
4838b47b19SEmilio G. Cota static inline void plugin_gen_disable_mem_helpers(void)
4938b47b19SEmilio G. Cota { }
5038b47b19SEmilio G. Cota 
51fcdab382SRichard Henderson static inline void plugin_gen_empty_mem_callback(TCGv_i64 addr, uint32_t info)
5238b47b19SEmilio G. Cota { }
5338b47b19SEmilio G. Cota 
5438b47b19SEmilio G. Cota #endif /* CONFIG_PLUGIN */
5538b47b19SEmilio G. Cota 
5638b47b19SEmilio G. Cota #endif /* QEMU_PLUGIN_GEN_H */
5738b47b19SEmilio G. Cota 
58