delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/06/19/16:15:12

From: "Billy Chen" <billyc AT intrex DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Need help for rdtsc inline asm
Date: Wed, 19 Jun 2002 16:15:08 -0400
Organization: Posted via Supernews, http://www.supernews.com
Message-ID: <uh1pdjn98fjc25@corp.supernews.com>
References: <Pine DOT A41 DOT 4 DOT 05 DOT 10206191836300 DOT 27608-100000 AT ieva06>
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
X-Complaints-To: newsabuse AT supernews DOT com
Lines: 47
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019