Peter Johnson wrote:
> On Wed, 19 Mar 2008, H. Peter Anvin wrote:
>> anonymous coward wrote:
>>>>> 5 0000000A 68FFFFFFFF
push 0xffffFFFF ; doesn't fit into sbyte -> dword
>>>> Broken. The sbyte form is functionally
identical.
>>> Wrong.
>>>
>>> The user did request FFFF_FFFF, which is
0000_0000_FFFF_FFFF.
>>> Which is different from sign-extending FF to
FFFF_FFFF_FFFF_FFFF.
>>>
>> Talking about 32-bit mode here; for 64-bit mode,
you're of course correct.
>
> Actually, you can't encode push 0000_0000_FFFF_FFFF in
64-bit mode. Push
> imm32 in 64-bit mode sign-extends the imm32. So 6AFF
and 68FFFFFFFF are
> exactly equivalent in 64-bit mode (they both push
FFFF_FFFF_FFFF_FFFF).
>
Well, "push 0FFFFFFFFh" should give a warning in
64-bit mode, since it
will push something other than what the user requested. It
could still
be downgraded to a 2-byte sequence (6A FF) since the
behaviour is
identical to the equally flawed 5-byte sequence (68 FF FF FF
FF).
However, in 32-bit mode, the two-byte sequence 6A FF will
push FFFFFFFF
on the stack, so "push 0FFFFFFFFh" should silently
be compressed to a
two-byte sequence.
-hpa
------------------------------------------------------------
-------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
a>
_______________________________________________
Nasm-devel mailing list
Nasm-devel lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nasm-devel
a>
|