[DUG] Assembler

Ian Gmail idrower at gmail.com
Mon Sep 27 14:11:03 NZDT 2010


  On 27/09/2010 11:56 a.m., Todd wrote:
> Hi Paul
>
> so this works
>
> movl TSparseList.FList, %eax
>
> but I don't think it is the equivalent of the original statement
>
> Function TSparseList.ForAll( ApplyFunction: Pointer {TSPAApply} ):
> Integer; assembler;
> Asm
>     MOV     EAX,[EAX].TSparseList.FList
>     JMP     TSparsePointerArray.ForAll
> End;
>
> After some reading, it seems the EAX register initially contains the
> memory address of the data block occupied by the TSparseList instance.
> So I'm wondering if this would work.
>
> addl TSparseList.FList, %eax
>
> Any suggestions?
>
> Todd.
>> movl 12(%eax), %eax
>>
>>> So I could do something like this?
>>>
>>> i := integer(@TSparseList(nil).FList);
>>> movl i(%eax), %eax
>>>
>> Unfortunately, no. You'd get the offset you want, but you can only use
>> constants in inline assembler, and I don't think delphi or freepascal
>> will consider your previous line to be a valid constant.
>>
>> So you'd need to write some code to determine all your offsets and then
>> set up constants for them all.
>>
>>
>>> The x86_64 version of FPC doesn't seem to like the BASM
>>> syntax, otherwise I wouldn't touch it. Or at least I can't
>>> figure out how to force FPC to compile it. The directive
>>> {$asmmode intel}  doesn't seem to work.
>>>
>> Bugger - especially as their x86 BASM syntax already supports the
>> structure member offset extension. And from the (somewhat terse)
>> freepascal documentation, I don't think there is an equivalent in AT&T
>> syntax.
>>
>> What kind of error messages are you getting? In 64-bit assembler, all
>> the registers commonly have different names (e.g. rax as opposed to to
>> eax). Maybe their assembler is fussy about that sort of thing?
>>
>> Is the x86_64 not support intel syntax a known limitation of freepascal?
>> It's not mentioned on the site anywhere I can see.
>>
>> Cheers,
>>     Paul.
>>
>> _______________________________________________
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi at delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe
>>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe



More information about the Delphi mailing list