This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
16-bit code in GAS
- From: Mikulas Patocka <mikulas at artax dot karlin dot mff dot cuni dot cz>
- To: binutils at sources dot redhat dot com, <bug-binutils at gnu dot org>
- Date: Fri, 15 Aug 2003 15:44:13 +0200 (CEST)
- Subject: 16-bit code in GAS
Hi
When I upgraded gas to 2.14, i found that it can't generate 32-bit
addresses in 16-bit mode (.code16) directive.
$ as
.code16
movl $0x12345678, 0xabcdef01
{standard input}: Assembler messages:
{standard input}:2: Warning: -1412567295 shortened to 61185
$ objdump --disassemble
a.out: file format elf32-i386
Disassembly of section .text:
00000000 <.text>:
0: 66 c7 06 01 ef movw $0xef01,(%esi)
5: 78 56 js 0x5d
7: 34 12 xor $0x12,%al
A
The resulting instruction should have prefixes 66 and 67 and should have
32-bit address.
Info page says, the the function of instructions in 16-bit mode is
exacltly the same as in 32-bit mode, but it's not true.
Older versions of gas generated both address and instruction prefixes and
generated 32-bit address.
How can I write 32-bit code that runs in a segment with default operand
size 16 (without 'D' bit set)?
Mikulas