qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] linux-user: Simplify timerid checks on g_pos


From: Laurent Vivier
Subject: Re: [Qemu-devel] [PATCH v2] linux-user: Simplify timerid checks on g_posix_timers range
Date: Fri, 22 Aug 2014 15:00:26 +0200 (CEST)


> Le 22 août 2014 à 14:29, Alexander Graf <address@hidden> a écrit :
>
>
>
>
> On 22.08.14 14:25, Peter Maydell wrote:
> > On 22 August 2014 13:12, Alexander Graf <address@hidden> wrote:
> >> In Linux, the timer id is a "key" into a hash table that the kernel
> >> searches to find its timer. In QEMU it's an offset into an array.
> >>
> >> In both cases the syscall user receives it as a token from a create
> >> function and should treat it as opaque.
> >>
> >> So in the QEMU case it is unsigned, regardless of what the kernel allows
> >> it to be, because it's an array offset.
> >
> > It's a number between 0 and 32. That doesn't imply that it has
> > to be an unsigned variable, and we already have it in a
> > signed variable arg1...
>
> Yes, so the end result will be the same. What's the point of this bike
> shedding?

On some archs, we can imagine libc/gcc filling only the 32 lower bits (= int) of the register during the syscall, and without modifying the 32 upper bits (= garbage). You must ignore the 32 upper bits (but you can ignore the sign too). I think you can let the mask but remove the sign checking -> your patch v1 was good ...
 
Regards,
Laurent

reply via email to

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