Subject: (data32, addr32) directives in NetBSD-i386 'as'
To: None <current-users@netbsd.org>
From: Eric Delcamp <e.delcamp_NOSPAM@wanadoo.fr>
List: current-users
Date: 04/08/2000 17:32:23
Hi !

I'm stuck with a program that need data32 and addr32 directives to feed
assembler in direct i386 instructions. The sources need at least binutils
v2.9.1 (NetBSD have), but our 'as' doesn't support theses directives. Here
is some informations (quoted from an assembly  file):

[...]
#ifdef  GAS295
#define DATA32 data32
#define ADDR32 addr32
#else
#define DATA32 data32;
#define ADDR32 addr32;
#endif

/*
 * NOTE: if you write a subroutine that is called from C code (gcc/egcs),
 * then you only have to take care of %ebx, %esi, %edi and %ebp.  These
 * registers must not be altered under any circumstance.  All other
registers
 * may be clobbered without any negative side effects.  If you don't follow
 * this rule then you'll run into strange effects that only occur on some
 * gcc versions (because the register allocator may use different
registers).
 *
 * All the data32 prefixes for the ljmp instructions are necessary, because
 * the assembler emits code with a relocation address of 0.  This means that
 * all destinations are initially negative, which the assembler doesn't
grok,
 * because for some reason negative numbers don't fit into 16 bits. The
addr32
 * prefixes are there for the same reasons, because otherwise the memory
 * references are only 16 bit wide.  Theoretically they are all superfluous.
 * One last note about prefixes: the data32 prefixes on all call
_real_to_prot
 * instructions could be removed if the _real_to_prot function is changed to
 * deal correctly with 16 bit return addresses.  I tried it, but failed.
 */
[...]

Thanks.