diff options
Diffstat (limited to 'simplex86.c')
-rw-r--r-- | simplex86.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/simplex86.c b/simplex86.c index 9c51f17..f77e812 100644 --- a/simplex86.c +++ b/simplex86.c @@ -1912,6 +1912,7 @@ emit (fragment_t *frag, const variant_t *variant, const op_t ops[4]) w = r = x = b = FALSE; + /* Emit opcode */ if (variant->encoding != E_ANNOTATE && variant->encoding != E_D) { if (variant->encoding == E_O) @@ -1927,8 +1928,9 @@ emit (fragment_t *frag, const variant_t *variant, const op_t ops[4]) c = emit_opcode (c, opc); } - - vex_regno = 0x0000; + + /* Emit operands */ + vex_regno = 0x0; switch (variant->encoding) { case E_RM: @@ -2053,10 +2055,10 @@ emit (fragment_t *frag, const variant_t *variant, const op_t ops[4]) } else { - uint8_t rex = 0x40 | (w << 3) | (r << 2) | (x << 1) | (b << 0); + uint8_t rex = (w << 3) | (r << 2) | (x << 1) | (b << 0); - if (rex != 0x40) - *p++ = rex; + if (rex) + *p++ = 0x40 | rex; } /* Emit immediates */ @@ -2091,7 +2093,7 @@ emit (fragment_t *frag, const variant_t *variant, const op_t ops[4]) add_annotation (&frag->annotations, &ann); } - array_append (&frag->code, p - prefixes + c - code, &d); + array_append (&frag->code, (p - prefixes) + (c - code), &d); memcpy (d, prefixes, p - prefixes); memcpy (d + (p - prefixes), code, c - code); } |