summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-08-28 17:47:16 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-08-28 17:47:16 -0700
commit962e30519cf128a7e2b78068ca8e697c6737b7a1 (patch)
tree61dcac8e2f6b4e1cc01fef2ef56a5889e0dba095
parent7b4dc622c695213fa0ee5f8d0b74502412478375 (diff)
downloadnasm-962e30519cf128a7e2b78068ca8e697c6737b7a1.tar.gz
BR 2029829: Accept VIA XCRYPT instructions with or without REP
Accept the VIA XCRYPT instructions either with or without a REP prefix, as documented. Add the missing XCRYPTCTR instruction.
-rw-r--r--assemble.c15
-rw-r--r--disasm.c4
-rw-r--r--insns.dat17
3 files changed, 28 insertions, 8 deletions
diff --git a/assemble.c b/assemble.c
index 9345fd8a..70228ac1 100644
--- a/assemble.c
+++ b/assemble.c
@@ -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");
diff --git a/disasm.c b/disasm.c
index b8674931..f3d4d2a3 100644
--- 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;
diff --git a/insns.dat b/insns.dat
index ee7f255e..7de63726 100644
--- 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