[Pixman] [PATCH] Use "=a" and "=d" constraints for rdtsc inline assembly

Søren Sandmann sandmann at cs.au.dk
Wed Mar 14 15:57:54 PDT 2012


Matt Turner <mattst88 at gmail.com> writes:

>>  static inline uint64_t
>>  oil_profile_stamp_rdtsc (void)
>>  {
>> -    uint64_t ts;
>> +    uint32_t hi, lo;
>>
>> -    __asm__ __volatile__ ("rdtsc\n" : "=A" (ts));
>> -    return ts;
>> +    __asm__ __volatile__ ("rdtsc\n" : "=a" (lo), "=d" (hi));
>> +
>> +    return lo | (((uint64_t)hi) << 32);
>>  }
>>
>>  #define OIL_STAMP oil_profile_stamp_rdtsc
>> --
>> 1.6.0.6
>
> Interesting. What were the symptoms of this bug?

The oil_profile_stamp_rdtsc() function is only used when --enable-timers
is used on the configure command line. In that case, the macros
TIMER_BEGIN() and TIMER_END() are defined. They can be used around a
piece of code and when the application exits some statistics will be
printed.

The symptoms were random crashes on 64 bit systems when this feature was
used.


Soren


More information about the Pixman mailing list