qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 2/4] cadence_ttc: initial version of device m


From: Paul Brook
Subject: Re: [Qemu-devel] [PATCH v3 2/4] cadence_ttc: initial version of device model
Date: Sat, 11 Feb 2012 14:18:49 +0000
User-agent: KMail/1.13.7 (Linux/3.1.0-1-amd64; KDE/4.6.5; x86_64; ; )

> +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

[Prev in Thread] Current Thread [Next in Thread]