Annotation of qemu/gen-icount.h, revision 1.1.1.5

1.1.1.3   root        1: #include "qemu-timer.h"
                      2: 
1.1       root        3: /* Helpers for instruction counting code generation.  */
                      4: 
                      5: static TCGArg *icount_arg;
                      6: static int icount_label;
                      7: 
                      8: static inline void gen_icount_start(void)
                      9: {
                     10:     TCGv_i32 count;
                     11: 
                     12:     if (!use_icount)
                     13:         return;
                     14: 
                     15:     icount_label = gen_new_label();
                     16:     count = tcg_temp_local_new_i32();
1.1.1.5 ! root       17:     tcg_gen_ld_i32(count, cpu_env, offsetof(CPUArchState, icount_decr.u32));
1.1       root       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);
                     21: 
                     22:     tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, icount_label);
1.1.1.5 ! root       23:     tcg_gen_st16_i32(count, cpu_env, offsetof(CPUArchState, icount_decr.u16.low));
1.1       root       24:     tcg_temp_free_i32(count);
                     25: }
                     26: 
                     27: static void gen_icount_end(TranslationBlock *tb, int num_insns)
                     28: {
                     29:     if (use_icount) {
                     30:         *icount_arg = num_insns;
                     31:         gen_set_label(icount_label);
1.1.1.4   root       32:         tcg_gen_exit_tb((tcg_target_long)tb + 2);
1.1       root       33:     }
                     34: }
                     35: 
1.1.1.2   root       36: static inline void gen_io_start(void)
1.1       root       37: {
                     38:     TCGv_i32 tmp = tcg_const_i32(1);
1.1.1.5 ! root       39:     tcg_gen_st_i32(tmp, cpu_env, offsetof(CPUArchState, can_do_io));
1.1       root       40:     tcg_temp_free_i32(tmp);
                     41: }
                     42: 
                     43: static inline void gen_io_end(void)
                     44: {
                     45:     TCGv_i32 tmp = tcg_const_i32(0);
1.1.1.5 ! root       46:     tcg_gen_st_i32(tmp, cpu_env, offsetof(CPUArchState, can_do_io));
1.1       root       47:     tcg_temp_free_i32(tmp);
                     48: }

unix.superglobalmegacorp.com