This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: 16-bit code in GAS
- From: Mikulas Patocka <mikulas at artax dot karlin dot mff dot cuni dot cz>
- To: Alan Modra <amodra at bigpond dot net dot au>
- Cc: binutils at sources dot redhat dot com, <bug-binutils at gnu dot org>
- Date: Fri, 15 Aug 2003 18:05:43 +0200 (CEST)
- Subject: Re: 16-bit code in GAS
> On Fri, Aug 15, 2003 at 03:44:13PM +0200, Mikulas Patocka wrote:
> > The resulting instruction should have prefixes 66 and 67 and should have
> > 32-bit address.
>
> It certainly looks buggy. I would have expected that gas generate just
> the data prefix and trim the address to 16 bit. Instead we get a 32 bit
It does exactly that, note that objdump --disassemble doesn't know about
.code16, so it displays nonsense --- you have to decode instruction
manually and it seems correct.
However I think it shouldn't do even that. Or maybe add another mode?:
1: .code16 (real mode or 286 protected mode)
2: .code32 without 'd' bit
3: .code32 with 'd' bit
On older versions .code16 used to behave like (2) but now it behaves like (1)
> address inserted into the instruction.
>
> > How can I write 32-bit code that runs in a segment with default operand
> > size 16 (without 'D' bit set)?
>
> .code16
> addr32 movl $0x12345678, 0xabcdef01
Thanks, it works.
Mikulas