[fpc-pascal] Porting Delphi ASM code to FPC

2009-08-24 Thread Graeme Geldenhuys
Hi, I have ported the DUnit2 testing framework from Delphi to FPC. DUnit2 works perfectly under 32bit FPC, but I am getting a compiler error when trying to compile DUnit2 with 64bit FPC. The error 'Unknown identifier EAX' occurs in the first line of function CallerAddr(...). I know that using

Re: [fpc-pascal] Porting Delphi ASM code to FPC

2009-08-24 Thread Jonas Maebe
On 24 Aug 2009, at 11:02, Graeme Geldenhuys wrote: I have ported the DUnit2 testing framework from Delphi to FPC. DUnit2 works perfectly under 32bit FPC, but I am getting a compiler error when trying to compile DUnit2 with 64bit FPC. The error 'Unknown identifier EAX' occurs in the first

Re: [fpc-pascal] Porting Delphi ASM code to FPC

2009-08-24 Thread Graeme Geldenhuys
Graeme Geldenhuys wrote: function CallerAddr: Pointer; assembler; const CallerIP = $4; asm mov eax, ebp call IsBadPointer test eax,eax jne @@Error mov eax, [ebp].CallerIP sub eax, 5 // 5 bytes for call push eax call IsBadPointer test

Re: [fpc-pascal] Porting Delphi ASM code to FPC

2009-08-24 Thread Vincent Snijders
Graeme Geldenhuys schreef: Hi, I have ported the DUnit2 testing framework from Delphi to FPC. DUnit2 works perfectly under 32bit FPC, but I am getting a compiler error when trying to compile DUnit2 with 64bit FPC. The error 'Unknown identifier EAX' occurs in the first line of function

Re: [fpc-pascal] Porting Delphi ASM code to FPC

2009-08-24 Thread Graeme Geldenhuys
Jonas Maebe wrote: Is there an existing function in FPC that does the same as CallerAddr(..), but in a cross platform way? get_caller_addr(get_frame) Just what I was looking for. Thank you! :-) It compiles now without problem, but Lazarus IDE can't seem to resolve the get_frame() function.

Re: [fpc-pascal] Porting Delphi ASM code to FPC

2009-08-24 Thread Graeme Geldenhuys
Jonas Maebe wrote: {$IFDEF INTERNAL_BACKTRACE} // nothing {$ELSE} function get_frame:pointer;{$ifdef SYSTEMINLINE}inline;{$endif} {$ENDIF} Compile with -va and look whether the compiler defines INTERNAL_BACKTRACE. Whether or not is irrelevant to the actual functionality though, it

Re: [fpc-pascal] Porting Delphi ASM code to FPC

2009-08-24 Thread Jonas Maebe
On 24 Aug 2009, at 11:40, Graeme Geldenhuys wrote: OK, my 64bit FPC does have INTERNAL_BACKTRACE defined, but does NOT have FPC_SYSTEM_HAS_GET_FRAME. So it seems my FPC doesn't have get_frame() function, but yet FPC is able to compile DUnit2. This is weird and I don't understand how