[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 2/2] xen/arm: sign extend writes to TimerValue
Hi Jeff, On 11/12/2019 21:13, Jeff Kubascik wrote: Per the ARMv8 Reference Manual (ARM DDI 0487E.a), section D11.2.4 specifies that the values in the TimerValue view of the timers are signed in standard two's complement form. When writing to the TimerValue Do you mean CompareValue register instead of TimerValue register? This explains the signed part, but it does not explain why the 32-bit case. So I would mention that TimerValue is a 32-bit signed integer.register, it should be signed extended as described by the equation CompareValue = (Counter[63:0] + SignExtend(TimerValue))[63:0] Maybe saying "are 32-bit signed in standard ..." Signed-off-by: Jeff Kubascik <jeff.kubascik@xxxxxxxxxxxxxxx> --- xen/arch/arm/vtimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c index 21b98ec20a..872181d9b6 100644 --- a/xen/arch/arm/vtimer.c +++ b/xen/arch/arm/vtimer.c @@ -211,7 +211,7 @@ static bool vtimer_cntp_tval(struct cpu_user_regs *regs, uint32_t *r, } else { - v->arch.phys_timer.cval = cntpct + *r; + v->arch.phys_timer.cval = cntpct + (uint64_t)(int32_t)*r; if ( v->arch.phys_timer.ctl & CNTx_CTL_ENABLE ) { v->arch.phys_timer.ctl &= ~CNTx_CTL_PENDING; Cheers, -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |