Mail Archives: djgpp/2002/06/19/16:15:12
This one works great, thanks every one
Billyc
"Andris Pavenis" <pavenis AT lanet DOT lv> wrote in message
news:Pine DOT A41 DOT 4 DOT 05 DOT 10206191836300 DOT 27608-100000 AT ieva06...
>
>
> On Tue, 18 Jun 2002, billy chen wrote:
>
> > Hi everyone,
> >
> > I try to write an inline asm code for getting the time stamp counter a
64
> > bits will store at edx:eax when rdtsc is called. Hoever I could not get
to
> > working by passing the compiler not allow the compiler (gcc 2.95.2
(djgpp
> > 2.03)) to follow the asm code for me, even I am using asm volatile
and
> > looks like the gas did not know how to translate the rdtsc code to
machine ?
> > Could some one help on this ?
>
> Which version of binutils do You have? Any reasonable resent binutils
> version understands rdtsc instruction. Anyway You can write something
> like:
>
> inline long long rdtsc(void)
> {
> union { long L[2]; long long LL; } W;
> asm __volatile__ (".byte 0x0F,0x31" : "=a"(W.L[0]), "=d"(W.L[1]));
> return W.LL;
> }
>
> (I have more nicer example somewhere, but I don't want to search now
> Also this should work).
>
> But make sure You are running CPU which supports RDTSC, or You'll get
> SIGILL
>
> Andris
>
>
>
>
- Raw text -