#65 ✓resolved
Peter Johnson

push imm8/imm32 - invalid combination of opcode and operands

Reported by Peter Johnson | June 25th, 2011 @ 07:49 PM

Originally posted on Trac by bird-yasm@anduin.net
Original Trac Ticket

  Description

Current svn snapshot (r1365) fails on "push 0" with the error "invalid combination of opcode and operands". It's possible to work around it by adding "byte" or "dword" in front of the imm. Nasm will generate "push dword 0".

Trac Attachments

h3. Trac Comments
comment:1

              Changed 5 years ago by bird-yasm@anduin.net


The following fixes the problem, don't know if it's The Right Thing (tm) though:

Index: modules/arch/x86/x86id.re
===================================================================
--- modules/arch/x86/x86id.re   (revision 1366)
+++ modules/arch/x86/x86id.re   (working copy)
@@ -626,14 +626,14 @@
       {OPT_Imm|OPS_32|OPA_Imm, 0, 0} },
     { CPU_Hammer|CPU_64, MOD_GasIllegal, 64, 64, 0, 1, {0x68, 0, 0}, 0, 1,
       {OPT_Imm|OPS_32|OPA_SImm, 0, 0} },
-    { CPU_Any, MOD_GasOnly|MOD_GasSufB, 0, 64, 0, 1, {0x6A, 0, 0}, 0, 1,
+    { CPU_Any, MOD_GasSufB, 0, 64, 0, 1, {0x6A, 0, 0}, 0, 1,
       {OPT_Imm|OPS_8|OPS_Relaxed|OPA_SImm, 0, 0} },
-    { CPU_Any, MOD_GasOnly|MOD_GasSufW, 16, 64, 0, 1, {0x68, 0x6A, 0}, 0, 1,
+    { CPU_Any, MOD_GasSufW, 16, 64, 0, 1, {0x68, 0x6A, 0}, 0, 1,
       {OPT_Imm|OPS_16|OPS_Relaxed|OPA_Imm|OPAP_SImm8Avail, 0, 0} },
-    { CPU_386|CPU_Not64, MOD_GasOnly|MOD_GasSufL, 32, 0, 0, 1,
+    { CPU_386|CPU_Not64, MOD_GasSufL, 32, 0, 0, 1,
       {0x68, 0x6A, 0}, 0, 1,
       {OPT_Imm|OPS_32|OPS_Relaxed|OPA_Imm|OPAP_SImm8Avail, 0, 0} },
-    { CPU_Hammer|CPU_64, MOD_GasOnly|MOD_GasSufQ, 64, 64, 0, 1,
+    { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 64, 0, 1,
       {0x68, 0x6A, 0}, 0, 1,
       {OPT_Imm|OPS_32|OPS_Relaxed|OPA_SImm|OPAP_SImm8Avail, 0, 0} },
     { CPU_Not64, 0, 0, 0, 0, 1, {0x0E, 0, 0}, 0, 1,

      comment:1

                  Changed 5 years ago by bird-yasm@anduin.net

      Component
        changed from Core to Architecture: x86

The following fixes the problem, don't know if it's The Right Thing (tm) though:

Index: modules/arch/x86/x86id.re
===================================================================
--- modules/arch/x86/x86id.re   (revision 1366)
+++ modules/arch/x86/x86id.re   (working copy)
@@ -626,14 +626,14 @@
       {OPT_Imm|OPS_32|OPA_Imm, 0, 0} },
     { CPU_Hammer|CPU_64, MOD_GasIllegal, 64, 64, 0, 1, {0x68, 0, 0}, 0, 1,
       {OPT_Imm|OPS_32|OPA_SImm, 0, 0} },
-    { CPU_Any, MOD_GasOnly|MOD_GasSufB, 0, 64, 0, 1, {0x6A, 0, 0}, 0, 1,
+    { CPU_Any, MOD_GasSufB, 0, 64, 0, 1, {0x6A, 0, 0}, 0, 1,
       {OPT_Imm|OPS_8|OPS_Relaxed|OPA_SImm, 0, 0} },
-    { CPU_Any, MOD_GasOnly|MOD_GasSufW, 16, 64, 0, 1, {0x68, 0x6A, 0}, 0, 1,
+    { CPU_Any, MOD_GasSufW, 16, 64, 0, 1, {0x68, 0x6A, 0}, 0, 1,
       {OPT_Imm|OPS_16|OPS_Relaxed|OPA_Imm|OPAP_SImm8Avail, 0, 0} },
-    { CPU_386|CPU_Not64, MOD_GasOnly|MOD_GasSufL, 32, 0, 0, 1,
+    { CPU_386|CPU_Not64, MOD_GasSufL, 32, 0, 0, 1,
       {0x68, 0x6A, 0}, 0, 1,
       {OPT_Imm|OPS_32|OPS_Relaxed|OPA_Imm|OPAP_SImm8Avail, 0, 0} },
-    { CPU_Hammer|CPU_64, MOD_GasOnly|MOD_GasSufQ, 64, 64, 0, 1,
+    { CPU_Hammer|CPU_64, MOD_GasSufQ, 64, 64, 0, 1,
       {0x68, 0x6A, 0}, 0, 1,
       {OPT_Imm|OPS_32|OPS_Relaxed|OPA_SImm|OPAP_SImm8Avail, 0, 0} },
     { CPU_Not64, 0, 0, 0, 0, 1, {0x0E, 0, 0}, 0, 1,

      Component
        changed from Core to Architecture: x86

comment:2

              Changed 5 years ago by bird-yasm@anduin.net


the first two changes wasn't the right thing at least.

comment:3

              Changed 5 years ago by peter@tortall.net


Fixed in [1371].  Yasm will also auto-size down to 8 bits if the value fits in 8 bits.  Thanks for the bug report!

      comment:3

                  Changed 5 years ago by peter@tortall.net

      Status
        changed from new to closed
    
      Resolution
        set to fixed

Fixed in [1371].  Yasm will also auto-size down to 8 bits if the value fits in 8 bits.  Thanks for the bug report!

      Status
        changed from new to closed
    
      Resolution
        set to fixed

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Yasm Modular Assembler Project

Shared Ticket Bins

People watching this ticket

Pages