[Nasm-bugs] [Bug 3392665] New: "mov ds, dword [0]" is not accepted and "mov ds, word [0]" in 32-bit segment does not put o16

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Sun May 24 12:36:44 PDT 2020


https://bugzilla.nasm.us/show_bug.cgi?id=3392665

            Bug ID: 3392665
           Summary: "mov ds, dword [0]" is not accepted and "mov ds, word
                    [0]" in 32-bit segment does not put o16
           Product: NASM
           Version: 2.15 (development)
          Hardware: All
                OS: All
            Status: OPEN
          Severity: minor
          Priority: Medium
         Component: Assembler
          Assignee: nobody at nasm.us
          Reporter: pushbx at ulukai.org
                CC: chang.seok.bae at intel.com, gorcunov at gmail.com,
                    hpa at zytor.com, nasm-bugs at nasm.us
     Obtained from: Built from git using configure

This is how NASM handles memory accesses with mov to ds:

$ cat test.asm 
        cpu 386
        bits BITS
mov ds, [0]
mov ds, word [0]
%ifdef ERROR
mov ds, dword [0]
%endif
$ nasm -v
NASM version 2.15rc0 compiled on Nov 22 2019
$ nasm test.asm -DBITS=16 && ndisasm -b16 test
00000000  8E1E0000          mov ds,[0x0]
00000004  8E1E0000          mov ds,[0x0]
$ nasm test.asm -DBITS=32 && ndisasm -b32 test
00000000  8E1D00000000      mov ds,[dword 0x0]
00000006  8E1D00000000      mov ds,[dword 0x0]
$ nasm test.asm -DBITS=16 -DERROR && ndisasm -b16 test
test.asm:6: error: mismatch in operand sizes
$ nasm test.asm -DBITS=32 -DERROR && ndisasm -b32 test
test.asm:6: error: mismatch in operand sizes
$

The disassembly is as expected for the generated machine code. But the explicit
dword specifier should be allowed in NASM source. Moreover, "mov ds, word [0]"
in a 32-bit CS should emit an o16 prefix.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are on the CC list for the bug.


More information about the Nasm-bugs mailing list