Re: [RFT] Port 0x80 I/O speed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


"=A" works on 32-bit systems (only), obviously, and gcc will generally produce slightly better code as a result (gcc could really use a register renaming/copy propagation step *after* multi-register entities are broken apart, at least on architectures which don't have register pairs as a hardware constraint.)

	-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux