From 4d2c38ce75ed73dd4c73fe3eb8ccbd42b0f11c76 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 4 May 2008 23:15:13 -0700 Subject: [PATCH] The AVX R,X,B, and V fields (but not W) are inverted. The AVX test cases are still not generated correctly, though. --- assemble.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/assemble.c b/assemble.c index 0c3f5f1b..7a237a06 100644 --- a/assemble.c +++ b/assemble.c @@ -1616,15 +1616,15 @@ static void gencode(int32_t segment, int64_t offset, int bits, codes += 2; if (ins->vex_m != 1 || (ins->rex & (REX_W|REX_X|REX_B))) { bytes[0] = 0xc4; - bytes[1] = ins->vex_m | ((ins->rex & 7) << 5); + bytes[1] = ins->vex_m | ((~ins->rex & 7) << 5); bytes[2] = ((ins->rex & REX_W) << (7-3)) | - (ins->drexdst << 3) | (ins->vex_wlp & 07); + ((~ins->drexdst & 15)<< 3) | (ins->vex_wlp & 07); out(offset, segment, &bytes, OUT_RAWDATA, 3, NO_SEG, NO_SEG); offset += 3; } else { bytes[0] = 0xc5; - bytes[1] = ((ins->rex & REX_R) << (7-2)) | - (ins->drexdst << 3) | (ins->vex_wlp & 07); + bytes[1] = ((~ins->rex & REX_R) << (7-2)) | + ((~ins->drexdst & 15) << 3) | (ins->vex_wlp & 07); out(offset, segment, &bytes, OUT_RAWDATA, 2, NO_SEG, NO_SEG); offset += 2; }