On Thu, Oct 14, 2010 at 3:37 PM, Steven McCoy <[email protected]> wrote:

> On 14 October 2010 20:24, Martin Pales <[email protected]> wrote:
>
>> Hello,
>>
>> the attached patch ensures that a correct rdtsc value is returned when
>> compiled
>> with sunstudio 12 compiler.
>>
>>
> I'm running Sun ONE Studio on Linux at it is working fine with the
> following which is pretty much the same as 0MQ's clock:
>
>          uint32_t lo, hi;
>
>  /* We cannot use "=A", since this would use %rax on x86_64 */
>          asm volatile ("rdtsc" : "=a" (lo), "=d" (hi));
>

Yes. A completely correct code should use 32 bit registers explicitly.
It would be something like this:

asm("rdtsc; movl %%edx,%0; movl %%eax,%1"
        : "=r" (hi), "=r" (lo) : : "%edx", "%eax");

However, the attached patch should also work correctly.

Martin


>         return (pgm_time_t)hi << 32 | lo;
> Where pgm_time_t is effectively uint64_t.
>
> --
> Steve-o
>
>
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to