summaryrefslogtreecommitdiff
path: root/gen_x86.c
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2012-12-29 22:11:28 -0800
committerMike Pavone <pavone@retrodev.com>2012-12-29 22:11:28 -0800
commit02f56f5ca59506d7d81a302511f59cb8d122e764 (patch)
tree69a740de5eee188aa12f75db05ed68cdf8635bc8 /gen_x86.c
parent8e2538755910dee022b72ccaeac487d1ae8900c7 (diff)
Fix encoding of movsx instruction when used with new (i.e. r9-r15) registers. This fixes the indexed addressing modes when used with a word-wide index register
Diffstat (limited to 'gen_x86.c')
-rw-r--r--gen_x86.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gen_x86.c b/gen_x86.c
index ebc06d6..bd4c2a4 100644
--- a/gen_x86.c
+++ b/gen_x86.c
@@ -962,11 +962,11 @@ uint8_t * movsx_rr(uint8_t * out, uint8_t src, uint8_t dst, uint8_t src_size, ui
*out |= REX_QUAD;
}
if (src >= R8) {
- *out |= REX_REG_FIELD;
+ *out |= REX_RM_FIELD;
src -= (R8 - X86_R8);
}
if (dst >= R8) {
- *out |= REX_RM_FIELD;
+ *out |= REX_REG_FIELD;
dst -= (R8 - X86_R8);
}
out++;
@@ -992,11 +992,11 @@ uint8_t * movsx_rdisp8r(uint8_t * out, uint8_t src, int8_t disp, uint8_t dst, ui
*out |= REX_QUAD;
}
if (src >= R8) {
- *out |= REX_REG_FIELD;
+ *out |= REX_RM_FIELD;
src -= (R8 - X86_R8);
}
if (dst >= R8) {
- *out |= REX_RM_FIELD;
+ *out |= REX_REG_FIELD;
dst -= (R8 - X86_R8);
}
out++;