forgot to post again.
----- Original Message -----
From: "Jeremy Jackson" <[EMAIL PROTECTED]>
To: "Eric Seppanen" <[EMAIL PROTECTED]>
Sent: Thursday, February 07, 2002 10:05 AM
Subject: Re: 16-bit address amd 32-bit address


> See objdump output of lilo MBR below.
>
> ----- Original Message -----
> From: "Eric Seppanen" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, February 06, 2002 11:07 AM
> Subject: Re: 16-bit address amd 32-bit address
>
>
> > On Wed, Feb 06, 2002 at 06:58:47PM +0200, Stefanos Papanicolopulos
wrote:
> > > Collins Chen wrote:
> > > > I encounter a problem about instruction
> > > > "jmp" and "call". I expect the "jmp" and
> > > > "call" with a 16-bit offset, but every
> > > > time the GCC compile them with 32-bit offset.
> > > > This cause the vga bios can't run. I don't
> > > > know how to fix it, can you help me? Thanks!
> > >
> > > It seems your disassembler thinks the code runs
> > > in 32bit mode. Don't worry. As you see, GCC get's
> > > it right: the bytes are the same! The point is
> > > that E8 (call) has a 'word' as an argument. Now,
> > > in 16-bit mode, a word is 16bits. In 32-bit a
> > > 'word' is 32bits. So in 16bit mode E8 is followed
> > > by 2 bytes, in 32bit it is followed by 4.
> >
> > I can confirm that objdump does not seem to be able to disassemble
> > 16-bit assembly.
> [root@clpanic jjackson]# which objdump
> /usr/bin/objdump
> [root@clpanic jjackson]# rpm -qf /usr/bin/objdump
> binutils-2.10.91.0.2-3
> [root@clpanic jjackson]# rpm -qa | grep redhat-release
> redhat-release-7.1-1
> [root@clpanic jjackson]# objdump -V
> GNU objdump 2.10.91
> Copyright 1997, 98, 99, 2000, 2001 Free Software Foundation, Inc.
> This program is free software; you may redistribute it under the terms of
> the GNU General Public License.  This program has absolutely no warranty.
> [root@clpanic jjackson]# objdump -b binary -D bootsect -m i8086
>
> bootsect:     file format binary
>
> Disassembly of section .data:
>
> 00000000 <.data>:
>    0:   fa                      cli
>    1:   eb 7c                   jmp    0x7f
>         ...
>   7f:   b8 c0 07                mov    $0x7c0,%ax
>   82:   8e d8                   mov    %ax,%ds
>   84:   8c 06 7a 00             movw   %es,122
>   88:   89 36 78 00             mov    %si,120
>   8c:   89 1e 7c 00             mov    %bx,124
>   90:   88 16 7e 00             mov    %dl,126
>   94:   b8 00 9a                mov    $0x9a00,%ax
>   97:   8e c0                   mov    %ax,%es
>   99:   b9 00 01                mov    $0x100,%cx
>   9c:   29 f6                   sub    %si,%si
>   9e:   29 ff                   sub    %di,%di
>   a0:   fc                      cld
>   a1:   f3 a5                   repz movsw %ds:(%si),%es:(%di)
>   a3:   ea a8 00 00 9a          ljmp   $0x9a00,$0xa8
>
> >
> > I have also had problems with gcc not correctly generating 16-bit code
> > is some cases (in mixed 16/32bit code where symbols need to be resolved
> > later by the linker).  I was not able to find a solution; maybe another
> > assembler would work better.
> >
>

Reply via email to