[fpc-pascal] Porting Delphi ASM code to FPC
Graeme Geldenhuys
graemeg at opensoft.homeip.net
Mon Aug 24 11:09:45 CEST 2009
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 eax,eax
> pop eax
> je @@Finish
>
> @@Error:
> xor eax, eax
> @@Finish:
> end;
By the way... Simply adding {$ASMMODE intel} at the top of the unit,
does not solve the problem either. It just moves the compiler message
down a few lines giving the following error.
/opt/git/dunit2/src/TestFramework.pas(2076,21) Error: Asm: 16 or 32 Bit
references not supported
Hence the reason I ask if there is a cross-platform function in FPC that
does similar to CallerAddr(..).
Regards,
- Graeme -
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/
More information about the fpc-pascal
mailing list