compiling turbo power lockbox on ubuntu 64

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

compiling turbo power lockbox on ubuntu 64

herux
Hi,
I use RSA encryption library lockbox turbo power.
in a windows environment I managed to compile and the apps working well, I use {$ mode delphi}.
but when I compile it on ubuntu 64bit, there is an error when compiling


component/LockBox/LbCipher.pas(708,10) Error: Unknown identifier "EBX"
component/LockBox/LbCipher.pas(708,10) Warning: No size specified and unable to determine the size of the operands, using DWORD as default
component/LockBox/LbCipher.pas(709,10) Error: Unknown identifier "EAX"
component/LockBox/LbCipher.pas(709,10) Warning: No size specified and unable to determine the size of the operands, using DWORD as default
component/LockBox/LbCipher.pas(710,13) Error: Unknown identifier "EAX"
component/LockBox/LbCipher.pas(710,15) Error: Assembler syntax error in operand
component/LockBox/LbCipher.pas(710,19) Error: Unknown identifier "EAX"
component/LockBox/LbCipher.pas(710,19) Error: Assembler syntax error in operand
component/LockBox/LbCipher.pas(711,12) Error: Unknown identifier "BH"
component/LockBox/LbCipher.pas(711,14) Error: Unknown identifier "AL"
component/LockBox/LbCipher.pas(712,12) Error: Unknown identifier "BL"
component/LockBox/LbCipher.pas(712,14) Error: Unknown identifier "AH"
component/LockBox/LbCipher.pas(713,13) Error: Unknown identifier "EBX"
so on ...

asm delphi like code doesn't compiled right ? but why on windows compiled ?

I am trying to cross compile it in windows, for linux x86_64, and produces the same error.
whether the asm code is not supported for 64bit?
-
Reply | Threaded
Open this post in threaded view
|

Re: compiling turbo power lockbox on ubuntu 64

Andreas Schneider-7
At Tuesday, 26.07.2011 on 10:13 herux wrote:

> Hi,
> I use RSA encryption library lockbox turbo power.
> in a windows environment I managed to compile and the apps working well, I
> use {$ mode delphi}.
> but when I compile it on ubuntu 64bit, there is an error when compiling
>
>
> component/LockBox/LbCipher.pas(708,10) Error: Unknown identifier "EBX"
> component/LockBox/LbCipher.pas(708,10) Warning: No size specified and unable
> to determine the size of the operands, using DWORD as default
> component/LockBox/LbCipher.pas(709,10) Error: Unknown identifier "EAX"
> component/LockBox/LbCipher.pas(709,10) Warning: No size specified and unable
> to determine the size of the operands, using DWORD as default
> component/LockBox/LbCipher.pas(710,13) Error: Unknown identifier "EAX"
> component/LockBox/LbCipher.pas(710,15) Error: Assembler syntax error in
> operand
> component/LockBox/LbCipher.pas(710,19) Error: Unknown identifier "EAX"
> component/LockBox/LbCipher.pas(710,19) Error: Assembler syntax error in
> operand
> component/LockBox/LbCipher.pas(711,12) Error: Unknown identifier "BH"
> component/LockBox/LbCipher.pas(711,14) Error: Unknown identifier "AL"
> component/LockBox/LbCipher.pas(712,12) Error: Unknown identifier "BL"
> component/LockBox/LbCipher.pas(712,14) Error: Unknown identifier "AH"
> component/LockBox/LbCipher.pas(713,13) Error: Unknown identifier "EBX"
> so on ...
>
> asm delphi like code doesn't compiled right ? but why on windows compiled ?
>
> I am trying to cross compile it in windows, for linux x86_64, and produces
> the same error.
> whether the asm code is not supported for 64bit?

Assembler code is (highly) processor dependent. x86_64 is a different architecture from x86 (well, it's actually an extension, but with certain restrictions/changes). x86_64 can still execute 32bit code, but if you want a 64bit application, the assembler code has to be written for 64bit aswell. If you want to compile for ARM, you have to write assembler for ARM. Same procedure with SPARC, POWER, etc.

In other words: you can't use that 32bit ASM when compiling as/for 64bit.

That's one of the reasons why you should avoid assembler whenever possible - and for LockBox it certainly was possible, but TurboPower liked to "optimize" their code by using loads of assembler.

--
Best Regards,
Andreas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

RE : [fpc-pascal] compiling turbo power lockbox on ubuntu 64

Ludo Brands
In reply to this post by herux
> Hi,
> I use RSA encryption library lockbox turbo power.
> in a windows environment I managed to compile and the apps
> working well, I use {$ mode delphi}.
> but when I compile it on ubuntu 64bit, there is an error when
> compiling
>
>
> component/LockBox/LbCipher.pas(708,10) Error: Unknown identifier "EBX"
> component/LockBox/LbCipher.pas(708,10) Warning: No size
> specified and unable to determine the size of the operands,
> using DWORD as default
> component/LockBox/LbCipher.pas(709,10) Error: Unknown identifier "EAX"
> component/LockBox/LbCipher.pas(709,10) Warning: No size
> specified and unable to determine the size of the operands,
> using DWORD as default
> component/LockBox/LbCipher.pas(710,13) Error: Unknown identifier "EAX"
> component/LockBox/LbCipher.pas(710,15) Error: Assembler
> syntax error in operand
> component/LockBox/LbCipher.pas(710,19) Error: Unknown identifier "EAX"
> component/LockBox/LbCipher.pas(710,19) Error: Assembler
> syntax error in operand
> component/LockBox/LbCipher.pas(711,12) Error: Unknown identifier "BH"
> component/LockBox/LbCipher.pas(711,14) Error: Unknown identifier "AL"
> component/LockBox/LbCipher.pas(712,12) Error: Unknown identifier "BL"
> component/LockBox/LbCipher.pas(712,14) Error: Unknown identifier "AH"
> component/LockBox/LbCipher.pas(713,13) Error: Unknown
> identifier "EBX" so on ...
>

These errors indicate that the wrong assembler style is selected. Use Intel
mode: {$asmmode intel}
This isn't going to solve your problem though. Variable parameters are 64
bit and passed in rax, rdx, not eax, edx. Pushing and popping registers
becomes push rsi instead of push esi. Register relative addressing is [rsi]
instead of [esi], etc. etc. etc.

Ludo

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: RE : [fpc-pascal] compiling turbo power lockbox on ubuntu 64

herux
thanks for the info for you guys,
where can I read the complete freepascal asm document for 64bit ?
-
Reply | Threaded
Open this post in threaded view
|

Re: RE : [fpc-pascal] compiling turbo power lockbox on ubuntu 64

Andreas Schneider-7
At Tuesday, 26.07.2011 on 15:31 herux wrote:
> thanks for the info for you guys,
> where can I read the complete freepascal asm document for 64bit ?

Assembler is not FreePascal specific.

But before you rewrite that Assembler into x86_64 compatible Intel assembler, you better rewrite it into native (Object)Pascal and get rid of the assembler code at all. It's a lot easier to write and to maintain. Plus you also get rid of platform specific code and most likely even gain performance, since the old code probably doesn't utilize all the current extensions like SSE(2, 3, 4, ...) and other things the compiler MIGHT do better.

--
Best Regards,
Andreas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: RE : [fpc-pascal] compiling turbo power lockbox on ubuntu 64

herux
I was thinking about the best alternative
yes, I think you're right. better to write it into native.

thank you
-