I have this assembler function in my application wriiten in delphi and this executes well on windows .But my requirement is to execute it on Linux as i am migrating my application on Linux. And while compiling this function in Linux i got error : "Unsupported language feature: 'ASM'".
Anybody can help or suggest how to implement it either in c++ or in delphi so that it works for Linux. sharing my code:
type
PVersionizedPointer = ^TVersionizedPointer;
TVersionizedPointer = packed record
Ver : NativeInt;
Ptr : Pointer;
end;
TVersionizedPointerStorage = array[0 .. 2 * sizeof(TVersionizedPointer) - 1] of byte;
function GetVersionizedPointer(var PointerStorage : TVersionizedPointerStorage) :
PVersionizedPointer; assembler;
const
vp_size = sizeof(TVersionizedPointer);
// Note: sizeof(any) inside asm is always $31
asm
{$ifdef CPUX86}
add EAX, vp_size - 1
and EAX, not(vp_size - 1)
{$endif}
{$ifdef CPUX64}
mov RAX, RCX
add RAX, vp_size - 1
and RAX, not(vp_size - 1)
{$endif}
end;
end;
TVersionizedPointerStorage?