This is the mail archive of the gas2@sourceware.cygnus.com mailing list for the gas2 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [masaki@eie.monolta.co.jp: GAS bug and etc]



   The problem with using the 16-bit jcxz is that, even if the offset is
   small, if the target isn't in the first 64K of memory, the program is
   toast.  The reason is that %eip is masked to 0x0000ffff AFTER adding
   the offset.

The comment you're referring to:

rel16/32 indicates that these instructions map to two; one with a 16-bit
relative displacement, the other with a 32-bit relative displacement,
depending on the operand-size attribute of the instruction.

only applies to the `rel16/32' versions of the conditional jump
instructions.  The JCXZ and JECXZ instructions do not allow 16- or
32-bit displacements.

The `Operation' section for that instruction should be more clear.

BTW, why are you using JCXZ or JECXZ at all?  The equivalent sequence:

testl %ecx,%ecx
jz ...

is the same speed on the 386, but faster on the Pentium (and probably
the 486, but I don't have those timing specs).