This implements emitters for INSN_TEST_IMM_MEMDISP.
Signed-off-by: Eduard - Gabriel Munteanu <[email protected]>
---
arch/x86/emit-code.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
index 440a63a..f20a0f0 100644
--- a/arch/x86/emit-code.c
+++ b/arch/x86/emit-code.c
@@ -2817,6 +2817,34 @@ static void emit_indirect_call(struct buffer *buf,
struct operand *operand)
emit(buf, encode_modrm(0x0, 0x2, reg));
}
+static void __emit_test_imm_memdisp(struct buffer *buf,
+ int rex_w,
+ long imm,
+ long disp)
+{
+ /* XXX: Supports only byte or long imms */
+
+ if (rex_w)
+ emit(buf, REX_W);
+
+ if (is_imm_8(imm))
+ emit(buf, 0xf6);
+ else
+ emit(buf, 0xf7);
+
+ emit(buf, 0x04);
+ emit(buf, 0x25);
+ emit_imm32(buf, disp);
+ emit_imm(buf, imm);
+}
+
+static void emit_test_imm_memdisp(struct buffer *buf,
+ struct operand *imm,
+ struct operand *disp)
+{
+ __emit_test_imm_memdisp(buf, 0, imm->imm, disp->disp);
+}
+
struct emitter emitters[] = {
GENERIC_X86_EMITTERS,
DECL_EMITTER(INSN_ADD_IMM_REG, emit_add_imm_reg, TWO_OPERANDS),
@@ -2843,6 +2871,7 @@ struct emitter emitters[] = {
DECL_EMITTER(INSN_SUB_IMM_REG, emit_sub_imm_reg, TWO_OPERANDS),
DECL_EMITTER(INSN_SUB_REG_REG, emit_sub_reg_reg, TWO_OPERANDS),
DECL_EMITTER(INSN_TEST_MEMBASE_REG, emit_test_membase_reg,
TWO_OPERANDS),
+ DECL_EMITTER(INSN_TEST_IMM_MEMDISP, emit_test_imm_memdisp,
TWO_OPERANDS),
};
void emit_prolog(struct buffer *buf, unsigned long nr_locals)
--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel