Subject: Re: assembly question
To: Alonso Bayona <alonso_bayona@hotmail.com>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: port-alpha
Date: 03/06/2002 19:56:49
On Thu, Mar 07, 2002 at 03:36:19AM +0000, Alonso Bayona wrote:

 > I was trying to count the number of bytes each instruction requires but the 
 > thing is that I don't know exactly what platform this assembly code was 
 > compiled on. I have searched the web and found that Alpha assembler is the 
 > one that resembles this code the most, but there are certain variations. 
 > Maybe you could help me out or point me in the rigth direction. Here are 
 > three lines which I can't count:
 > 
 > movl $1,-12(%ebp)
 > 
 > incl %esi
 > 
 > leal (%edx,%eax),%esi

This is not Alpha asm code.  It's i386.

Those instructions do:

	Move the immediate value 1 into the memory location -12(%ebp).

	Increment the %esi register by one.

	Load the effective address (%edx,%eax) into the %esi register.
	(Sorry, I don't program in x86 much, so I don't know specifically
	what addressing mode that insn is using.)

i386 instructions are variable-length, so the number of bytes required for
each one varies with each instruction and the operands.  Alpha instructions
have a fixed-length of 4 bytes.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>