From 85cfa2bb7834854e587f466cb877b4bf5ed7966e Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Mon, 23 Jun 2014 11:05:55 -0400 Subject: Fix x86_rrindex_sizedir. Pass the correct scale to mov_rindexr in gen_mem_fun. BlastEm now sort of works on OS X. Runs reliably from lldb, but only intermittently from the shell --- gen_x86.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'gen_x86.c') diff --git a/gen_x86.c b/gen_x86.c index c062ac8..2ec4c00 100644 --- a/gen_x86.c +++ b/gen_x86.c @@ -359,13 +359,11 @@ uint8_t * x86_rrindex_sizedir(uint8_t * out, uint8_t opcode, uint8_t reg, uint8_ opcode |= BIT_SIZE; } *(out++) = opcode | dir; - *(out++) = MODE_REG_INDIRECT | base | (RSP << 3); - if (base == RSP) { - if (scale == 4) { - scale = 3; - } - *(out++) = scale << 6 | (index << 3) | base; + *(out++) = MODE_REG_INDIRECT | RSP | (reg << 3); + if (scale == 4) { + scale = 3; } + *(out++) = scale << 6 | (index << 3) | base; return out; } -- cgit v1.2.3