[DUG] Assembler
Paul Heinz
paul at accredo.co.nz
Mon Sep 27 22:38:00 NZDT 2010
Hi Todd
> 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.
Yes - that will be right.
> So I'm wondering if this would work.
>
>
Well, that should add the (hopefully) correct offset.
> Any suggestions?
You'll need to follow that with an explicit derefence:
addl TSparseList.FList, %eax
movl (%eax), %eax
Those two instructions combined should give the same effect as a single
movl TSpareList.FList(%eax), %eax
But have you tried the above instruction directly?
Given the addl above, that should be the AT&T equivalent syntax for
MOV EAX, [EAX].TSparseList.FList
One thing that is still bothering me though is that in a 64-bit
application, shouldn't this all be using 64-bit addresses and registers?
I don't know the context of what you're trying to port and Windows may
convenient be giving you addresses that are all clear in the high
32-bits but it's not safe to assume that in 64-bit code.
i.e.
movq TSpareList.Flist(%rax), %rax
q = quadword (64-bit) where l = longword (32-bit)
Cheers,
Paul.
More information about the Delphi
mailing list