BR 2029829: Accept VIA XCRYPT instructions with or without REP
authorH. Peter Anvin <hpa@zytor.com>
Fri, 29 Aug 2008 00:47:16 +0000 (17:47 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Fri, 29 Aug 2008 00:47:16 +0000 (17:47 -0700)
Accept the VIA XCRYPT instructions either with or without a REP
prefix, as documented.

Add the missing XCRYPTCTR instruction.

assemble.c
disasm.c
insns.dat

index 9345fd8..70228ac 100644 (file)
@@ -93,6 +93,9 @@
  * \333          - REP prefix (0xF3 byte) used as opcode extension.
  * \334          - LOCK prefix used instead of REX.R
  * \335          - disassemble a rep (0xF3 byte) prefix as repe not rep.
+ * \336          - force a REP(E) prefix (0xF2) even if not specified.
+ * \337                 - force a REPNE prefix (0xF3) even if not specified.
+ *                 \336-\337 are still listed as prefixes in the disassembler.
  * \340          - reserve <operand 0> bytes of uninitialized storage.
  *                 Operand 0 had better be a segmentless constant.
  * \360                 - no SSE prefix (== \364\331)
@@ -1039,6 +1042,14 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits,
            break;
         case 0335:
            break;
+       case 0336:
+           if (!ins->prefixes[PPS_LREP])
+               ins->prefixes[PPS_LREP] = P_REP;
+           break;
+       case 0337:
+           if (!ins->prefixes[PPS_LREP])
+               ins->prefixes[PPS_LREP] = P_REPNE;
+           break;
         case 0340:
             if (ins->oprs[0].segment != NO_SEG)
                 errfunc(ERR_NONFATAL, "attempt to reserve non-constant"
@@ -1705,6 +1716,10 @@ static void gencode(int32_t segment, int64_t offset, int bits,
         case 0335:
            break;
 
+        case 0336:
+        case 0337:
+           break;
+
         case 0340:
             if (ins->oprs[0].segment != NO_SEG)
                 errfunc(ERR_PANIC, "non-constant BSS size in pass two");
index b867493..f3d4d2a 100644 (file)
--- a/disasm.c
+++ b/disasm.c
@@ -882,6 +882,10 @@ static int matches(const struct itemplate *t, uint8_t *data,
                 drep = P_REPE;
            break;
 
+       case 0336:
+       case 0337:
+           break;
+
        case 0340:
            return false;
 
index ee7f255..7de6372 100644 (file)
--- a/insns.dat
+++ b/insns.dat
@@ -3333,14 +3333,15 @@ VFNMSUBSS       xmmreg,xmmreg,xmmrm,xmmreg      [rsmv:  vex.nds.128.66.0f3a.w0 7e /r /is4]      F
 VFNMSUBSS      xmmreg,xmmreg,xmmreg,xmmrm      [rsvm:  vex.nds.128.66.0f3a.w1 7e /r /is4]      FMA,SANDYBRIDGE,SD
 
 ;# VIA (Centaur) security instructions
-XSTORE         void                            \360\3\x0F\xA7\xC0                              PENT,CYRIX
-XCRYPTECB      void                            \363\3\x0F\xA7\xC8                              PENT,CYRIX
-XCRYPTCBC      void                            \363\3\x0F\xA7\xD0                              PENT,CYRIX
-XCRYPTCFB      void                            \363\3\x0F\xA7\xE0                              PENT,CYRIX
-XCRYPTOFB      void                            \363\3\x0F\xA7\xE8                              PENT,CYRIX
-MONTMUL                void                            \363\3\x0F\xA6\xC0                              PENT,CYRIX
-XSHA1          void                            \363\3\x0F\xA6\xC8                              PENT,CYRIX
-XSHA256                void                            \363\3\x0F\xA6\xD0                              PENT,CYRIX
+XSTORE         void                            \3\x0F\xA7\xC0                                  PENT,CYRIX
+XCRYPTECB      void                            \336\3\x0F\xA7\xC8                              PENT,CYRIX
+XCRYPTCBC      void                            \336\3\x0F\xA7\xD0                              PENT,CYRIX
+XCRYPTCTR      void                            \336\3\x0F\xA7\xD8                              PENT,CYRIX
+XCRYPTCFB      void                            \336\3\x0F\xA7\xE0                              PENT,CYRIX
+XCRYPTOFB      void                            \336\3\x0F\xA7\xE8                              PENT,CYRIX
+MONTMUL                void                            \336\3\x0F\xA6\xC0                              PENT,CYRIX
+XSHA1          void                            \336\3\x0F\xA6\xC8                              PENT,CYRIX
+XSHA256                void                            \336\3\x0F\xA6\xD0                              PENT,CYRIX
 
 ;# Systematic names for the hinting nop instructions
 ; These should be last in the file