This fixes membase instructions in the two special cases when %r12 and %r13 are used as base registers. These cases require different encodings, similar to what is done with %rsp (and %esp on x86-32).
Signed-off-by: Eduard - Gabriel Munteanu <eduard.munte...@linux360.ro> --- arch/x86/emit-code.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c index 2ef7d3e..e149cf2 100644 --- a/arch/x86/emit-code.c +++ b/arch/x86/emit-code.c @@ -2467,16 +2467,17 @@ static void __emit_membase(struct buffer *buf, { unsigned char rex_pfx = 0, mod, rm, mod_rm; unsigned char __base_reg = __encode_reg(base_reg); - int needs_sib; + int needs_sib, needs_disp; - needs_sib = (base_reg == MACH_REG_RSP); + needs_sib = (base_reg == MACH_REG_RSP || base_reg == MACH_REG_R12); + needs_disp = (disp || base_reg == MACH_REG_R13); if (needs_sib) rm = 0x04; else rm = __base_reg; - if (disp == 0) + if (!needs_disp) mod = 0x00; else if (is_imm_8(disp)) mod = 0x01; @@ -2501,7 +2502,7 @@ static void __emit_membase(struct buffer *buf, if (needs_sib) emit(buf, encode_sib(0x00, 0x04, __base_reg)); - if (disp) + if (needs_disp) emit_imm(buf, disp); } -- 1.6.0.6 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel