OBones wrote:
The function starts at line 26 so the errors are about "dword ptr" and "abs qword ptr" inside the fs and gs square brackets What is wrong with my syntax? Is there another way to write it and get it to work?
Ok, answering myself here, the syntax accepted by FPC is the following:

function MyGetCurrentThreadId: DWORD; assembler;
asm
  {$IFDEF WIN32}
  push    ecx
  mov     ecx,dword ptr fs:[$18]
  mov     eax,dword ptr [ecx + $24]
  pop     ecx
  {$ENDIF WIN32}
  {$IFDEF WIN64}
  push    rcx
  mov     rcx,abs qword ptr gs:[$30]
  xor     rax,rax
  mov     eax,dword ptr [rcx + $48]
  pop     rcx
  {$ENDIF WIN64}
end;

However, this gives a warning on line 36, the one with "abs qword ptr" :

RuntimeCodeUtils.pas(36,19) Warning: (7032) Calling an overload function in assembler

So it seems it thinks that abs is there for calling the "abs" function while I want to specify absolute memory referencing and not relative referencing.

Any hints?
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to