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: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2] linux-user: Simplify timerid checks on g_posix_timers range
Date: Fri, 22 Aug 2014 14:09:00 +0100

On 22 August 2014 14:00, Laurent Vivier <address@hidden> wrote:
>> Le 22 août 2014 à 14:29, Alexander Graf <address@hidden> a écrit :
>> On 22.08.14 14:25, Peter Maydell wrote:
>> > 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?

Not much, except that it's a smaller and simpler patch if you
just remove the bogus masking.

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

No, this is wrong I think. do_syscall() is passed a set of arguments
of type "abi_long". It's true that the calling convention might be
such that  if abi_long is 32 bits and host registers are 64 bits then
the upper half of the host register might be garbage. But in that
case the compiler is obliged to implement casts and other operations
on the variable so they behave correctly. So you never need to worry
about it.

v1 was was definitely wrong. v2 is correct but gratuitously fiddly.
But I don't care enough to actually demand a v3.

thanks
-- PMM



reply via email to

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