[MPlayer-dev-eng] [PATCH] Make cpuinfo calculate correct frequency under x86-64
Zuxy Meng
zuxy.meng at gmail.com
Fri Feb 19 08:10:12 CET 2010
2010/2/19 Reimar Döffinger <Reimar.Doeffinger at gmx.de>:
> On Thu, Feb 18, 2010 at 11:12:23PM +0800, Zuxy Meng wrote:
>> '=A' under x86-64 means %rdx:%rax instead of %edx:%eax so cpuinfo will
>> produce wrong result. The attached patch makes this small program work
>> well under both x86 and x86-64.
>
> But the type is wrong for x86, the registers are not 64 bit on x86.
> And on x86-64 it's also eax:edx you want, so the type should be uint32_t
> (of course you need a cast for the shift then).
That was my original idea but when I checked the assembly I found that
the compiler has no idea about the fact that rdtsc clears the upper
half of %rax and %rdx and will generate extra mov to clear them.
--
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6
More information about the MPlayer-dev-eng
mailing list