This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GAS macro formals as expression


On Wed, Sep 10, 2003 at 09:09:04AM -0700, Ian Lance Taylor wrote:
> Ian Lance Taylor <ian@airs.com> writes:
> 
> > I think gas is more flexible than you give it credit for.  Try this
> > version.  It probably needs some tweaks, but I think the general
> > approach should be workable.
> > 
> 
> Oh yeah, I should mention that a sample call is
> 	ldCachePentium2 (%esp),0x2c0
> and that `NN' should probably be replaced by `NN\@'.

Thanks! Works great for me. Little chances to support offsets start
different from 0 and it produces the same code as masm. 

For those interested:

.macro  ldCachePentium2 offset,addr,byteCnt
        NN\@ = 0
        .rept   (\byteCnt + 63) / 64
                .ifeq   ((NN\@ + \offset) & 0xffffffff)
                        mov \addr,%eax
                .else
                        mov ((\offset + NN\@) & 0xffffffff) \addr,%eax
                .endif
                .if     (NN\@ + 32) < \byteCnt
                        mov ((\offset + NN\@ + 36) & 0xffffffff) \addr,%ebx
                .endif
                NN\@ = NN\@ + 64
        .endr
.endm

Regards, Clemens

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]