l*dt/lea/l*s

Peter Johnson peter at tortall.net
Wed Nov 1 20:09:04 PST 2006


Samuel,

Thanks for the patch, but I have some concerns with what it does.  It 
really needs a testcase to demonstrate what it allows that yasm didn't 
used to allow, and why it makes sense to allow it.

I've tried to make yasm generate errors for things that are very 
misleading in code; see the below examples.

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).  I could perhaps 
stomach allowing

     lds eax, dword [foo]

as it least matches the register size, but I feel that allowing *any* size 
is way too broad.

With regards to the lea change, right now I allow either the register size 
or no size, but not *any* size.  A similar "non-misleading" rule applies; 
do you really want

     lea rax, byte [rdx+rbx+5]

assembling without error?  Right now both of these are allowed:

     lea rax, [rdx+rbx+5]
     lea rax, qword [rdx+rbx+5]

I know it's not reading anything from memory here, but the mismatch in 
size would cause a reader of the code to think the code with "byte" is 
doing something that the instruction doesn't actually do (like move just 
the LSB of the evaluated expression into rax).

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.

Thanks,
Peter

On Wed, 1 Nov 2006, Samuel Thibault wrote:

> The proposed patch.
>
> Samuel
>


More information about the yasm-devel mailing list