From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4abdf0ad9d593e46 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-03 06:58:56 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!cambridge1-snf1.gtei.net!news.gtei.net!bos-service1.ext.raytheon.com!dfw-service2.ext.raytheon.com.POSTED!not-for-mail Message-ID: <3CFB75E3.D0D64BC8@raytheon.com> From: Mark Johnson X-Mailer: Mozilla 4.76 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: GNAT Inline machine code References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Mon, 03 Jun 2002 08:57:55 -0500 NNTP-Posting-Host: 192.27.48.39 X-Complaints-To: news@ext.ray.com X-Trace: dfw-service2.ext.raytheon.com 1023112735 192.27.48.39 (Mon, 03 Jun 2002 08:58:55 CDT) NNTP-Posting-Date: Mon, 03 Jun 2002 08:58:55 CDT Organization: Raytheon Company Xref: archiver1.google.com comp.lang.ada:25256 Date: 2002-06-03T08:57:55-05:00 List-Id: Magnus Andersson wrote: > > How do I read the system clock using GNAT inline assembler? > > This results in compiler error "No code generated for file rdtsc.ads > (package spec)": > > asm("rdtsc "); > asm("movl %%eax, %0", Outputs => Interfaces.Unsigned_32'Asm_Output ("=g", > high123) ); > Hmm. Not sure. We implement this as a function similar to... function Rdtsc return Interfaces.Unsigned_64 is Result : Interfaces.Unsigned_64; begin asm(" byte 0x0f, 0x31", Interfaces.Unsigned_64'Asm_Output("=A",Result), Volatile=>True); return Result; end Rdtsc; [I removed a bunch of our specific data types and code checks for this example...] to fetch the 64 bit value. Don't forget the Volatile flag for code like this (for when you optimize). If you only want half the value, you could modify this or use some more code to extract just what you want.... --Mark