xref: /openbmc/qemu/accel/tcg/internal-common.h (revision d16cab541ab9217977e2a39abf3d79f914146741)
15934660fSPhilippe Mathieu-Daudé /*
25934660fSPhilippe Mathieu-Daudé  * Internal execution defines for qemu (target agnostic)
35934660fSPhilippe Mathieu-Daudé  *
45934660fSPhilippe Mathieu-Daudé  *  Copyright (c) 2003 Fabrice Bellard
55934660fSPhilippe Mathieu-Daudé  *
65934660fSPhilippe Mathieu-Daudé  * SPDX-License-Identifier: LGPL-2.1-or-later
75934660fSPhilippe Mathieu-Daudé  */
85934660fSPhilippe Mathieu-Daudé 
95934660fSPhilippe Mathieu-Daudé #ifndef ACCEL_TCG_INTERNAL_COMMON_H
105934660fSPhilippe Mathieu-Daudé #define ACCEL_TCG_INTERNAL_COMMON_H
115934660fSPhilippe Mathieu-Daudé 
12b254c342SPhilippe Mathieu-Daudé #include "exec/cpu-common.h"
1343e7a2d3SPhilippe Mathieu-Daudé #include "exec/translation-block.h"
1443e7a2d3SPhilippe Mathieu-Daudé 
155934660fSPhilippe Mathieu-Daudé extern int64_t max_delay;
165934660fSPhilippe Mathieu-Daudé extern int64_t max_advance;
175934660fSPhilippe Mathieu-Daudé 
18*eeb6198eSPhilippe Mathieu-Daudé extern bool one_insn_per_tb;
19*eeb6198eSPhilippe Mathieu-Daudé 
2043e7a2d3SPhilippe Mathieu-Daudé /*
2143e7a2d3SPhilippe Mathieu-Daudé  * Return true if CS is not running in parallel with other cpus, either
2243e7a2d3SPhilippe Mathieu-Daudé  * because there are no other cpus or we are within an exclusive context.
2343e7a2d3SPhilippe Mathieu-Daudé  */
cpu_in_serial_context(CPUState * cs)2443e7a2d3SPhilippe Mathieu-Daudé static inline bool cpu_in_serial_context(CPUState *cs)
2543e7a2d3SPhilippe Mathieu-Daudé {
26b254c342SPhilippe Mathieu-Daudé     return !tcg_cflags_has(cs, CF_PARALLEL) || cpu_in_exclusive_context(cs);
2743e7a2d3SPhilippe Mathieu-Daudé }
2843e7a2d3SPhilippe Mathieu-Daudé 
29fc44d592SPhilippe Mathieu-Daudé /**
30fc44d592SPhilippe Mathieu-Daudé  * cpu_plugin_mem_cbs_enabled() - are plugin memory callbacks enabled?
31fc44d592SPhilippe Mathieu-Daudé  * @cs: CPUState pointer
32fc44d592SPhilippe Mathieu-Daudé  *
33fc44d592SPhilippe Mathieu-Daudé  * The memory callbacks are installed if a plugin has instrumented an
34fc44d592SPhilippe Mathieu-Daudé  * instruction for memory. This can be useful to know if you want to
35fc44d592SPhilippe Mathieu-Daudé  * force a slow path for a series of memory accesses.
36fc44d592SPhilippe Mathieu-Daudé  */
cpu_plugin_mem_cbs_enabled(const CPUState * cpu)37fc44d592SPhilippe Mathieu-Daudé static inline bool cpu_plugin_mem_cbs_enabled(const CPUState *cpu)
38fc44d592SPhilippe Mathieu-Daudé {
39fc44d592SPhilippe Mathieu-Daudé #ifdef CONFIG_PLUGIN
4080f034c5SPhilippe Mathieu-Daudé     return !!cpu->neg.plugin_mem_cbs;
41fc44d592SPhilippe Mathieu-Daudé #else
42fc44d592SPhilippe Mathieu-Daudé     return false;
43fc44d592SPhilippe Mathieu-Daudé #endif
44fc44d592SPhilippe Mathieu-Daudé }
45fc44d592SPhilippe Mathieu-Daudé 
46*eeb6198eSPhilippe Mathieu-Daudé TranslationBlock *tb_gen_code(CPUState *cpu, vaddr pc,
47*eeb6198eSPhilippe Mathieu-Daudé                               uint64_t cs_base, uint32_t flags,
48*eeb6198eSPhilippe Mathieu-Daudé                               int cflags);
49*eeb6198eSPhilippe Mathieu-Daudé void page_init(void);
50*eeb6198eSPhilippe Mathieu-Daudé void tb_htable_init(void);
51*eeb6198eSPhilippe Mathieu-Daudé void tb_reset_jump(TranslationBlock *tb, int n);
52*eeb6198eSPhilippe Mathieu-Daudé TranslationBlock *tb_link_page(TranslationBlock *tb);
53*eeb6198eSPhilippe Mathieu-Daudé void cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb,
54*eeb6198eSPhilippe Mathieu-Daudé                                uintptr_t host_pc);
55*eeb6198eSPhilippe Mathieu-Daudé 
56*eeb6198eSPhilippe Mathieu-Daudé bool tcg_exec_realizefn(CPUState *cpu, Error **errp);
57*eeb6198eSPhilippe Mathieu-Daudé void tcg_exec_unrealizefn(CPUState *cpu);
58*eeb6198eSPhilippe Mathieu-Daudé 
595934660fSPhilippe Mathieu-Daudé #endif
60