This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]