QMP: Improve RTC_CHANGE event description
[qemu/ar7.git] / gen-icount.h
blob8879da633525f3ecfe78b64092f7b3cec6397067
1 #include "qemu-timer.h"
3 /* Helpers for instruction counting code generation. */
5 static TCGArg *icount_arg;
6 static int icount_label;
8 static inline void gen_icount_start(void)
10 TCGv_i32 count;
12 if (!use_icount)
13 return;
15 icount_label = gen_new_label();
16 count = tcg_temp_local_new_i32();
17 tcg_gen_ld_i32(count, cpu_env, offsetof(CPUState, icount_decr.u32));
18 /* This is a horrid hack to allow fixing up the value later. */
19 icount_arg = gen_opparam_ptr + 1;
20 tcg_gen_subi_i32(count, count, 0xdeadbeef);
22 tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, icount_label);
23 tcg_gen_st16_i32(count, cpu_env, offsetof(CPUState, icount_decr.u16.low));
24 tcg_temp_free_i32(count);
27 static void gen_icount_end(TranslationBlock *tb, int num_insns)
29 if (use_icount) {
30 *icount_arg = num_insns;
31 gen_set_label(icount_label);
32 tcg_gen_exit_tb((long)tb + 2);
36 static inline void gen_io_start(void)
38 TCGv_i32 tmp = tcg_const_i32(1);
39 tcg_gen_st_i32(tmp, cpu_env, offsetof(CPUState, can_do_io));
40 tcg_temp_free_i32(tmp);
43 static inline void gen_io_end(void)
45 TCGv_i32 tmp = tcg_const_i32(0);
46 tcg_gen_st_i32(tmp, cpu_env, offsetof(CPUState, can_do_io));
47 tcg_temp_free_i32(tmp);