On 10/23/2017 02:21 AM, Wolf wrote:


On 23/10/17 02:53, Nikolay Nikolov wrote:

FPC trunk supports rdtscp. And if you're using a FPC version that doesn't support an instruction, you can always hardcode it with 'db' (make sure you add a comment with the real instruction to keep your code readable), e.g:

db 0fh, 01h, 0f9h  { rdtscp - not supported by FPC 3.0's inline assembler }

Nikolay

db 0fh, 01h, 0f9h is a Delphi instruction, as far as I can make it out. It does not work with FPC 3.00 - at least with the settings Lazarus provides by default running under Linux.
What does work is
      .byte 0x0F, 0x01, 0xF9    // read the Time-Stamp Counter rdtscp (as op-code format,                                               // requires setting the compiler switch -aas                                               // in Lazarus: Options/Custom Options/All Options )
Yes, that's AT&T asm syntax. FPC supports both AT&T and Intel syntax modes with the {$asmmode} directive:

https://www.freepascal.org/docs-html/prog/progsu3.html

AT&T is the default for historical reasons, but Intel also works fine.

Nikolay
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to