bug-binutils
[Top][All Lists]
Advanced

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

can objdump really handle 8086 code?


From: Zeeshan Ali
Subject: can objdump really handle 8086 code?
Date: Wed, 9 Jun 2004 14:58:13 -0700 (PDT)

Hello,
  I am doubtfull if objdump can really handle 8086
code. Take the following C code for example:

asm (".code16gcc\n");

static void afunc ();

void _start ()
{
  afunc ();

  while (1);
}

static void afunc ()
{
  asm ("movb $0x0E, %ah\n"
       "movb $0x69, %al\n"
       "movb $0x00, %bh\n"
       "movb $0x07, %bl\n"
       "int $0x10\n");
}

compiled to pure binary using:

gcc -c lilo.c
ld -static -Ttext 0x7C00 --oformat binary lilo.o -o
lilo.bin

then if you do `objdump -D -m i8086 -b binary
lilo.bin`, you get the following output:

0000000000000000 <.data>:
   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. But if you comment out the 'asm
(".code16gcc\n");' line and recompile and disassemble
using the same procedure/commands above, you get this
output:

   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.


=====
"The whole problem with the world is that fools and fanatics are always so 
certain
of themselves, but wiser people so full of doubts." ---Bertrand Russell

"Liberty without socialism is privilege and injustice, and that socialism 
without liberty is slavery and brutality."  ---Mikhail Bakunin


        
                
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 




reply via email to

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