On 26/11/2014 11:39, Pavel Dovgalyuk wrote:
> +int64_t cpu_get_instructions_counter(void)
> +{
> +    /* This function calls are synchnonized to timer changes,
> +       calling cpu_get_instructions_counter_locked without lock is safe */
> +    int64_t icount = timers_state.qemu_icount;
> +    CPUState *cpu = current_cpu;
> +
> +    if (cpu) {
> +        icount -= (cpu->icount_decr.u16.low + cpu->icount_extra);
> +    }
> +    return icount;

Why do you need to do this if !cpu_can_do_io(cpu)?

Perhaps a better name for the functions is

- cpu_get_instructions_counter_locked -> cpu_get_icount_raw

- cpu_get_instructions_counter -> cpu_get_icount_raw_nocheck

This makes it clear that cpu_get_instructions_counter should raise
questions to a reviewer.

Paolo

Reply via email to