[fpc-pascal] detect CPU cores

Tomas Hajny XHajT03 at hajny.biz
Fri Sep 12 17:30:02 CEST 2014


On Fri, September 12, 2014 17:15, Xiangrong Fang wrote:
> 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.
 .
 .

This code uses Intel syntax of assembler routines. You need to add
{$ASMMODE INTEL} before the assembler block, or use one of compilation
modes using this assembler mode by default (such a {$MODE DELPHI} or
{$MODE TP}).

Tomas





More information about the fpc-pascal mailing list