[fpc-pascal] detect CPU cores
Dmitry Boyarintsev
skalogryz.lists at gmail.com
Sat Sep 13 06:57:41 CEST 2014
Please disregard my previous statement abour renaming register names. I was
completely wrong. The problem most likely was with a wrong asm mode. Try to
specify the asm mode explicitly by adding
{$ASMMODE INTEL}
at the begging of the unit.
You might try an alternative version here: http://pastebin.com/ujyBLjYZ
Register names and more important ABIs are CPU dependent 32 vs 64 bit.
Has little to do with OS, though knowledgable apporach is necessary.
If you need to have the code working for both 32 and 64, you might need to
use compiler directive $IFDEF.with the CPU target you need.
The good news, if you compile win32 bit application it will run just fine
on win64 and will provide you with the most accurate results possible.So
you can use the existing 32-bit code.
IRC, some extra efforts would be needed to run 32-bit binary on 64bit Linux.
thanks,
Dmitry
On Fri, Sep 12, 2014 at 11:12 PM, Xiangrong Fang <xrfang at gmail.com> wrote:
> 2014-09-13 0:28 GMT+08:00 Dmitry Boyarintsev <skalogryz.lists at gmail.com>:
>
>> You're compiling for x64, You need to replace "eax" and "edx" with "rax"
>> and "rdx", since e?x are available for i386 only.
>>
>>
> My situation is, I program and test on Ubuntu x64 on a i3-M390. Then
> compile it to Windows 32bit on a VirtualBox on this machine, then run it on
> a Windows 32bit running on a rather old pentium dual core (T-something, I
> don't know if it is 32bit or 64bit processor).
>
> regarding e?x vs. r?x, is it only related to the CPU, or also has
> something to do with the OS (32bit or 64bit)? How to do "conditional
> compiling" for assembly code?
>
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140913/1d17281f/attachment.html>
More information about the fpc-pascal
mailing list