Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Mar 1996 18:36:40 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        dahanaya@chaph.usc.edu, koshy@india.hp.com
Cc:        hackers@freebsd.org
Subject:   Re: help - assembly
Message-ID:  <199603010736.SAA00619@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>2.	You have to indicate the size of operands as part of the opcode
>	mnemonic. 

>	For example:

>	movl	%eax,	%ebx	# moves 32 bits from eax to ebx
>	movw	%ax,	%bx	# moves 16 bits from ax to bx ...

>	The suffixes are 'l' for 32 bit operands, 'w' for 16 bit operands,
>	'b' for byte operands.  The assembler will cross check that the
>	opcode's implied size and the actual sizes of the operands match.
>	This catches lots of interesting bugs before they can occur.

Actually, it will get this wrong quite often, and introduce lots of
interesting bugs if you forget the suffixes or use the wrong register
names (%ax instead of %eax...).  Example: something like

	movl	%al,%bh
	   ^ oops

You have to indicate the size of operands only to avoid these bugs.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603010736.SAA00619>