I found this code on the net:

http://code.google.com/p/fpos/source/browse/kernel/cpuid.pas?r=c387b381d7a05f9328693cdcf59b0b4f633294e4

It's part of the "FreePascal Operationg System" project. I suppose it is
compatible with FreePascal of course. But while compiled, I got lots of
errors, such as:

cpuid.pas(28,3) Error: Unrecognized opcode pushfd
cpuid.pas(29,10) Error: Unknown identifier "EAX"
cpuid.pas(30,13) Error: Unknown identifier "EDX"

Even I added {$mode objfpc}{$H+} does not help.

I tried to compile this code on this platform:

CPU: i3 M 390
OS: Ubuntu x64
FPC: 2.6.4

How to use assembly in fpc anyway?

Thanks.

2014-09-12 22:28 GMT+08:00 Dmitry Boyarintsev <skalogryz.li...@gmail.com>:

> If you're talking bout x88_64, i386 platforms, you should be able to do it
> using CPUID instruction
>
> http://en.wikipedia.org/wiki/CPUID
>
> thanks,
> Dmitry
>
> On Fri, Sep 12, 2014 at 10:07 AM, Xiangrong Fang <xrf...@gmail.com> wrote:
>
>> Hi All,
>>
>> Is there a platform independent (specifically Windows and Linux) way to
>> detect cores and hyper-threads of the CPU? I am writing a calculation
>> intensive app and would like to fully utilize SMP capability of the CPU.
>>
>> Thanks!
>> Xiangrong
>>
>>
>> _______________________________________________
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>>
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to