lkml.org 
[lkml]   [2007]   [Dec]   [12]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateWed, 12 Dec 2007 18:41:15 -0800
From"H. Peter Anvin" <>
SubjectRe: [RFT] Port 0x80 I/O speed
Rene Herman wrote:
> On 12-12-07 06:23, Kyle McMartin wrote:
> 
>> On Wed, Dec 12, 2007 at 12:31:18AM +0100, Rene Herman wrote:
>>>     asm volatile ("rdtsc": "=A" (tsc));
>>
>> rdtsc returns a 64-bit value in two 32-bit regs, you need to do
>>
>> inline unsigned long long rdtsc(void)
>> {
>>     unsigned int lo, hi;
>>     asm volatile ("rdtsc": "=a" (lo), "=d" (hi));
>>     return (unsigned long long)hi << 32 | lo;
>> }
>>
>> as in msr.h, otherwise you'll only be looking at the value in %rax.
> 
> On 32-bit, "=A" is edx:eax. Not sure what the point is in not letting it 
> be that on 64-bit in fact, but yes, the thing should be compiled as 32-bit.

On 64-bit, "=A" is rdx:rax, which means that a 64-bit value ends up in 
rax only (a 128-bit value, which gcc does support on 128-bit platforms, 
would be in rdx:rax.)

gcc can't deal internally with values that span partial registers.

	-hpa


\
 
 \ /
  Last update: 2007-12-13 03:47    [from the cache]
©2003-2008