l*dt/lea/l*s

Samuel Thibault samuel.thibault at ens-lyon.org
Thu Nov 2 08:08:30 PST 2006


Hi,

Peter Johnson, le Wed 01 Nov 2006 20:09:04 -0800, a écrit :
> With regards to the lds/les/etc change, I don't like the idea of
> 
>     lds eax, byte [foo]
> 
> assembling without error, as it makes for extremely misleading code (as 
> the value being loaded is really 6 bytes in size)

Oops, I should probably have explained the case I'm encountering.  Maybe
you'll remember that I wanted to work on Tasm support for yasm.  A first
version is ready, which supports enough of Tasm features for being able
to compile loadlin (that was the main target).

The problem I got with Tasm was that the size of memory operands. In
tasm,

	mov [foo],1

is allowed, and the operation size defaults to the size of elements of
foo.  For this to work with yasm, I hence had to add the pointed memory
size into operand structures, and provide that up to the x86 module.
But then lea/l*s would refuse

	lea ax,[foo]

because the memory size of foo may not be the register size.

> The twobytemem change is a bit too broad; it affects a lot more than just 
> the ldt instructions.  The reason it's set the way it is right now is I 
> think that all of the instructions that use this have weird memory access 
> sizes.  If I've made a mistake and that's not the case (e.g. ldt actually 
> reads a 32-bit value or something along those lines), I'd be happy to fix 
> that case to allow the actual size memory access as well as no size.

Same problem here with yasm: descriptors would usually be described this
way:

descr dw 0
      dw 0

Hence the "tasm default size" for descr is word, and is refused by the
x86 module.

That said, maybe I should distinguish between "tasm default size" and
"user size overrides", and modify x86 module's rules a bit for refusing
bogus user size overrides, and only use "tasm default size" when nothing
else permits to guess the operand size.

Samuel


More information about the yasm-devel mailing list