grok VIA C3 xmove-* and xcrypt-* instructions

This commit is contained in:
brad 2004-02-10 23:27:14 +00:00
parent 9cc0d86a15
commit 74ffd7dcbb

View File

@ -0,0 +1,76 @@
$OpenBSD: patch-opcodes_i386-dis_c,v 1.1 2004/02/10 23:27:14 brad Exp $
--- opcodes/i386-dis.c.orig 2003-06-02 16:35:17.000000000 -0400
+++ opcodes/i386-dis.c 2004-02-10 18:20:17.000000000 -0500
@@ -91,6 +91,7 @@ static void OP_EX PARAMS ((int, int));
static void OP_MS PARAMS ((int, int));
static void OP_XS PARAMS ((int, int));
static void OP_3DNowSuffix PARAMS ((int, int));
+static void OP_xcrypt PARAMS ((int, int));
static void OP_SIMD_Suffix PARAMS ((int, int));
static void SIMD_Fixup PARAMS ((int, int));
static void BadOp PARAMS ((void));
@@ -293,6 +294,7 @@ fetch_data (info, addr)
#define XS OP_XS, v_mode
#define None OP_E, 0
#define OPSUF OP_3DNowSuffix, 0
+#define OPXCRYPT OP_xcrypt, 0
#define OPSIMD OP_SIMD_Suffix, 0
#define cond_jump_flag NULL, cond_jump_mode
@@ -943,6 +945,7 @@ static const struct dis386 dis386_twobyt
{ "shldS", Ev, Gv, Ib },
{ "shldS", Ev, Gv, CL },
{ "(bad)", XX, XX, XX },
+ { "", OPXCRYPT, XX, XX },
{ "(bad)", XX, XX, XX },
/* a8 */
{ "pushT", gs, XX, XX },
@@ -3972,6 +3975,17 @@ OP_XS (bytemode, sizeflag)
BadOp ();
}
+static struct {
+ unsigned char opc;
+ char *name;
+} xcrypt[] = {
+ { 0xc0, "xstore-rng" },
+ { 0xc8, "xcrypt-ecb" },
+ { 0xd0, "xcrypt-cbc" },
+ { 0xe0, "xcrypt-cfb" },
+ { 0xe8, "xcrypt-ofb" },
+};
+
static const char *const Suffix3DNow[] = {
/* 00 */ NULL, NULL, NULL, NULL,
/* 04 */ NULL, NULL, NULL, NULL,
@@ -4066,6 +4080,30 @@ OP_3DNowSuffix (bytemode, sizeflag)
}
}
+static void
+OP_xcrypt (bytemode, sizeflag)
+ int bytemode ATTRIBUTE_UNUSED;
+ int sizeflag ATTRIBUTE_UNUSED;
+{
+ const char *mnemonic = NULL;
+ unsigned int i;
+
+ FETCH_DATA (the_info, codep + 1);
+ /* VIA C3 xcrypt-* & xmove-* instructions are specified by an opcode
+ suffix in the place where an 8-bit immediate would normally go.
+ ie. the last byte of the instruction. */
+ obufp = obuf + strlen(obuf);
+
+ for (i = 0; i < sizeof(xcrypt) / sizeof(xcrypt[0]); i++)
+ if (xcrypt[i].opc == (*codep & 0xff))
+ mnemonic = xcrypt[i].name;
+ codep++;
+ if (mnemonic)
+ oappend (mnemonic);
+ else
+ BadOp();
+}
+
static const char *simd_cmp_op[] = {
"eq",
"lt",