> +static void cadence_timer_sync(CadenceTimerState *s)
> +{
>...
> +    r = (int64_t)cadence_timer_get_steps(s, s->cpu_time - old_time);
> +    x = (int64_t)s->reg_value + ((s->reg_count & COUNTER_CTRL_DEC) ? -r :
> r); +
> +    for (i = 0; i < 3; ++i) {
> +        if (is_between((int64_t)s->reg_match[i] << 16, s->reg_value, x)) {
> +            s->reg_intr |= (2 << i);
> +        }
> +    }

By my reading this will miss events if they happen after the timer wraps.
e.g. for a count-up timer with reg_match==1 and the tick callback happens to 
get delayed by 4 cycles, the timer may wrap straight to reg_value = 3.

Paul

Reply via email to