bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: can objdump really handle 8086 code?


From: Alan Modra
Subject: Re: can objdump really handle 8086 code?
Date: Thu, 10 Jun 2004 09:26:42 +0930
User-agent: Mutt/1.4i

On Wed, Jun 09, 2004 at 02:58:13PM -0700, Zeeshan Ali wrote:
[snip]
>    0:   66 55                   push   %ebp
>    2:   66 89 e5                mov    %esp,%ebp
>    5:   66 83 ec 08             sub    $0x8,%esp
>    9:   66 e8 02 00 00 00       calll  0x11
>    f:   eb fe                   jmp    0xf
>   11:   66 55                   push   %ebp
>   13:   66 89 e5                mov    %esp,%ebp
>   16:   b4 0e                   mov    $0xe,%ah
>   18:   b0 69                   mov    $0x69,%al
>   1a:   b7 00                   mov    $0x0,%bh
>   1c:   b3 07                   mov    $0x7,%bl
>   1e:   cd 10                   int    $0x10
>   20:   66 5d                   pop    %ebp
>   22:   66 c3                   retl
> 
>   which obviously contains 32-bit instructions like:
> retl, calll etc.

Well, yes, but the default mode was 16-bit.  Notice that the "66"
operand size prefix is needed to generate 32-bit instructions.

[snip]
>    0:   55                      push   %bp
>    1:   89 e5                   mov    %sp,%bp
>    3:   83 ec 08                sub    $0x8,%sp
>    6:   e8 02 00                call   0xb
>    9:   00 00                   add    %al,(%bx,%si)
>    b:   eb fe                   jmp    0xb
>    d:   55                      push   %bp
>    e:   89 e5                   mov    %sp,%bp
>   10:   b4 0e                   mov    $0xe,%ah
>   12:   b0 69                   mov    $0x69,%al
>   14:   b7 00                   mov    $0x0,%bh
>   16:   b3 07                   mov    $0x7,%bl
>   18:   cd 10                   int    $0x10
>   1a:   5d                      pop    %bp
>   1b:   c3                      ret
> 
>    Now, objdump shows no 32-bit code, despite the fact
> that code is a 32-bit code.

This is 32-bit code disassembled with the wrong options.  Notice the
instruction at address 9, and the fact that the call at address 6 goes
to the wrong place.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre




reply via email to

[Prev in Thread] Current Thread [Next in Thread]