xref: /qemu/accel/tcg/internal-common.h (revision 4abc8923)
1 /*
2  * Internal execution defines for qemu (target agnostic)
3  *
4  *  Copyright (c) 2003 Fabrice Bellard
5  *
6  * SPDX-License-Identifier: LGPL-2.1-or-later
7  */
8 
9 #ifndef ACCEL_TCG_INTERNAL_COMMON_H
10 #define ACCEL_TCG_INTERNAL_COMMON_H
11 
12 #include "exec/cpu-common.h"
13 #include "exec/translation-block.h"
14 
15 extern int64_t max_delay;
16 extern int64_t max_advance;
17 
18 /*
19  * Return true if CS is not running in parallel with other cpus, either
20  * because there are no other cpus or we are within an exclusive context.
21  */
22 static inline bool cpu_in_serial_context(CPUState *cs)
23 {
24     return !tcg_cflags_has(cs, CF_PARALLEL) || cpu_in_exclusive_context(cs);
25 }
26 
27 /**
28  * cpu_plugin_mem_cbs_enabled() - are plugin memory callbacks enabled?
29  * @cs: CPUState pointer
30  *
31  * The memory callbacks are installed if a plugin has instrumented an
32  * instruction for memory. This can be useful to know if you want to
33  * force a slow path for a series of memory accesses.
34  */
35 static inline bool cpu_plugin_mem_cbs_enabled(const CPUState *cpu)
36 {
37 #ifdef CONFIG_PLUGIN
38     return !!cpu->neg.plugin_mem_cbs;
39 #else
40     return false;
41 #endif
42 }
43 
44 #endif
45