Re: [fpc-pascal] Inline assembly using absolute dword ptr

2012-04-23 Thread OBones
Jonas Maebe wrote: On 20 Apr 2012, at 17:50, OBones wrote: So there is a difference with Delphi's assembler where it defaults to relative indexing while FPC defaults to absolute in that context. What exactly do you mean by relative addressing in this context? RIP-relative? In FPC, you indeed

Re: [fpc-pascal] Inline assembly using absolute dword ptr

2012-04-20 Thread Jonas Maebe
On 20 Apr 2012, at 17:50, OBones wrote: > So there is a difference with Delphi's assembler where it defaults to > relative indexing while FPC defaults to absolute in that context. What exactly do you mean by relative addressing in this context? RIP-relative? In FPC, you indeed have to explicit

Re: [fpc-pascal] Inline assembly using absolute dword ptr

2012-04-20 Thread OBones
OBones wrote: Jonas Maebe wrote: {$IFDEF WIN64} pushrcx mov rcx,gs:[abs qword ptr $30] And this: mov rcx,qword ptr gs:[$30] Thanks, but does this guarantee absolute indexing? I'm asking because the abs keyword is required when using the same code under Delphi XE2. If I don

Re: [fpc-pascal] Inline assembly using absolute dword ptr

2012-04-20 Thread OBones
Jonas Maebe wrote: {$IFDEF WIN64} pushrcx mov rcx,gs:[abs qword ptr $30] And this: mov rcx,qword ptr gs:[$30] Thanks, but does this guarantee absolute indexing? I'm asking because the abs keyword is required when using the same code under Delphi XE2. If I don't use it, that

Re: [fpc-pascal] Inline assembly using absolute dword ptr

2012-04-20 Thread Jonas Maebe
On 20 Apr 2012, at 17:27, OBones wrote: > I'm trying to compile the following code under FreePascal 2.6.0 : > > function MyGetCurrentThreadId: DWORD; assembler; > asm > {$IFDEF WIN32} > pushecx > mov ecx,fs:[dword ptr $18] Use this instead: mov ecx,dword ptr fs:[$18] > {$IFDEF

Re: [fpc-pascal] Inline assembly using absolute dword ptr

2012-04-20 Thread OBones
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: f

[fpc-pascal] Inline assembly using absolute dword ptr

2012-04-20 Thread OBones
Hello, I'm trying to compile the following code under FreePascal 2.6.0 : function MyGetCurrentThreadId: DWORD; assembler; asm {$IFDEF WIN32} pushecx mov ecx,fs:[dword ptr $18] mov eax,dword ptr [ecx + $24] pop ecx {$ENDIF WIN32} {$IFDEF WIN64} pushrcx mov