Subject: port-i386/2370: i386 gas missing a movw variant
To: None <gnats-bugs@NetBSD.ORG>
From: Brad Spencer <brad@anduin.eldar.org>
List: netbsd-bugs
Date: 05/02/1996 23:40:37
>Number:         2370
>Category:       port-i386
>Synopsis:       i386 gas missing a movw variant
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri May  3 00:05:02 1996
>Last-Modified:
>Originator:     Brad Spencer
>Organization:
	Home
>Release:        Source supped around 4/27
>Environment:
System: NetBSD anduin.eldar.org 1.1B NetBSD 1.1B (ANDUIN) #1: Thu May 2 19:34:38 EDT 1996 brad@anduin.eldar.org:/usr/src/sys/arch/i386/compile/ANDUIN i386


>Description:

gas, as used with NetBSD/i386, will not handle the 'movw' instruction
when it is of the form:

	movw %ds,-10(%ebp)
or
	movw %es,-6(%ebp)

[I believe this reduces to 'movw segment_register,word_memory_location']

This omission causes problems when trying to compile 'wine', the
MS-WINDOWS emulator.  The supplied diff allows wine to compile and
appear to run [but, of course, the diff has not been proven correct,
it just causes things to work].

It should be further noted that gas for NetBSD/i386 [and FreeBSD, it
turns out] also does not handle a variant of the 'lcall' instruction,
which 'wine' also uses.  The 'wine' developers, however, have made a
work around for this omission.

>How-To-Repeat:
Try to compile 'wine'....

>Fix:

*** i386.h	Fri Oct 13 20:15:40 1995
--- /usr/local/src/usr.bin/gas/opcode/i386.h	Wed May  1 21:47:07 1996
***************
*** 27,33 ****
  { "mov", 2, 0x88, _, DW|Modrm, Reg, Reg|Mem, 0 },
  { "mov", 2, 0xb0, _, ShortFormW, Imm, Reg, 0 },
  { "mov", 2, 0xc6, _,  W|Modrm,  Imm, Reg|Mem, 0 },
! { "mov", 2, 0x8c, _, D|Modrm,  SReg3|SReg2, Reg16|Mem16, 0 },
  /* move to/from control debug registers */
  { "mov", 2, 0x0f20, _, D|Modrm, Control, Reg32, 0},
  { "mov", 2, 0x0f21, _, D|Modrm, Debug, Reg32, 0},
--- 27,33 ----
  { "mov", 2, 0x88, _, DW|Modrm, Reg, Reg|Mem, 0 },
  { "mov", 2, 0xb0, _, ShortFormW, Imm, Reg, 0 },
  { "mov", 2, 0xc6, _,  W|Modrm,  Imm, Reg|Mem, 0 },
! { "mov", 2, 0x8c, _, D|Modrm,  SReg3|SReg2, Reg16|Mem16|WordMem, 0 },
  /* move to/from control debug registers */
  { "mov", 2, 0x0f20, _, D|Modrm, Control, Reg32, 0},
  { "mov", 2, 0x0f21, _, D|Modrm, Debug, Reg32, 0},
>Audit-Trail:
>Unformatted: