The instruction size passed to rip_relative() is actually constant, i.e.
the size of an imm32, which is 4 bytes. That is because we have already
emitted the prefix bytes and the opcode.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munte...@linux360.ro>
---
 arch/x86/emit-code.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
index 54332b9..642c89b 100644
--- a/arch/x86/emit-code.c
+++ b/arch/x86/emit-code.c
@@ -1915,7 +1915,6 @@ static void __emit_memdisp(struct buffer *buf,
                           unsigned char reg_opcode)
 {
        unsigned char rex_pfx = 0, mod_rm;
-       size_t insn_size = 6;
 
        if (rex_w)
                rex_pfx |= REX_W;
@@ -1924,13 +1923,11 @@ static void __emit_memdisp(struct buffer *buf,
 
        mod_rm = encode_modrm(0, reg_opcode, 5);
 
-       if (rex_pfx) {
+       if (rex_pfx)
                emit(buf, rex_pfx);
-               insn_size++;
-       }
        emit(buf, opc);
        emit(buf, mod_rm);
-       emit_imm32(buf, rip_relative(buf, disp, insn_size));
+       emit_imm32(buf, rip_relative(buf, disp, 4));
 }
 
 static void __emit_memdisp_reg(struct buffer *buf,
-- 
1.6.0.6


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to