https://sourceware.org/bugzilla/show_bug.cgi?id=24485

            Bug ID: 24485
           Summary: IRET with .code16gcc
           Product: binutils
           Version: 2.30
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: nulano at nulano dot eu
  Target Milestone: ---

The .code16gcc directive generates real-mode X86 code and sets the default
operand size to 32 bits (by adding the operand size prefix to every instruction
which can use it). This allows the GNU compiler to generate real-mode code.

This directive also affects the IRET (return from interrupt) instruction. This
is incorrect, as in real-mode an interrupt will almost always be called with a
16-bit call (using the INT instruction) -- the only exception is a PUSHFD
followed by a CALLD used to chain interrupts, I fail to see how that is useful,
but I expect it to be written explicitly.


Code:
    .code16gcc
    .text
    iret

Will output:
    66 CF   IRETD (assuming real mode)

Should output:
    CF      IRETW (assuming real mode)


Found in version: GNU assembler version 2.30 (x86_64-w64-mingw32)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to