Re: add edi,0FFFFFFFFH



On 15 Aug, 09:19, "Rod Pemberton"
<do_not_h...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
It's important for assembly to produce exactly what it was told to do...
Not being able to generate a specific instruction encoding is an issue
I've seen with other assemblers

It's never been my opinion that an assembler should allow you to
generate any instruction encoding, only that it should generate an
encoding which performs the requested operation (ideally an
'optimised' encoding, when there is a choice). For example consider
those encodings which incorporate a 'direction' (d) bit; do you
suggest that an assembler should allow you to generate both these
encodings, and if so how (32-bit code, but the point remains the
same):

03 C3 add eax,ebx
01 D8 add eax,ebx

What about cases where there are dedicated encodings for the EAX
register. Would you expect an assembler to allow you to choose
between these alternatives:

83 C0 08 add eax,8
05 08 00 00 00 add eax,8
81 C0 08 00 00 00 add eax,8

Although I can see why you might want to choose between alternative
encodings in some specific cases, requiring that you can generate
*any* valid encoding seems somewhat unreasonable and I'm not aware of
any assembler that does (other than by using DBs).

Richard.
http://www.rtrussell.co.uk/
.



Relevant Pages

  • Re: Nasm lgdt and lidt
    ... don't know of any use case were the specific encoding is so important. ... in 32 bit mode or higher, the assembler can choose to encode the stuff as ... my assembler let you choose the "fingerprint" ... Well, I'd want a warning issued there, but only at request. ...
    (comp.lang.asm.x86)
  • Re: Nasm lgdt and lidt
    ... don't know of any use case were the specific encoding is so important. ... What is more important, assembler, especially when used as ... only because "nestlevel" is out of range ... imm8 Create a nested stack frame for a procedure ...
    (comp.lang.asm.x86)
  • Re: add edi,0FFFFFFFFH
    ... Not being able to generate a specific instruction encoding is an issue ... It's never been my opinion that an assembler should allow you to ... Would I prefer 81h to 05h for eax by default, or for the lowest optimization ...
    (comp.lang.asm.x86)
  • Re: What do I do with Art Of Assembly?
    ... >> whether HLA is an assembler or not. ... instructions for the CPU as well as the data for the these ... If this program is feed to the assembler, ... > directive (because the correct encoding to be used entirely depends on ...
    (alt.lang.asm)
  • Re: add edi,0FFFFFFFFH
    ... Not being able to generate a specific instruction encoding is an issue ... Would you expect an assembler to allow you to choose ... compilers should default to shortest/fastest. ...
    (comp.lang.asm.x86)