From aa5f3c1cf2b5783207517c3422a2740c80af209a Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 24 Jun 2007 04:15:18 +0000 Subject: [PATCH] - added some jit stuff for cs:s dm --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401015 --- public/jit/jit_helpers.h | 8 ++++++++ public/jit/x86/x86_macros.h | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/public/jit/jit_helpers.h b/public/jit/jit_helpers.h index c882a307e..c6c18fda5 100644 --- a/public/jit/jit_helpers.h +++ b/public/jit/jit_helpers.h @@ -62,6 +62,14 @@ public: } outptr++; } + inline void write_ushort(unsigned short c) + { + if (outbase) + { + *(unsigned short *)outptr = c; + } + outptr += sizeof(unsigned short); + } inline void write_byte(jit_int8_t c) { if (outbase) diff --git a/public/jit/x86/x86_macros.h b/public/jit/x86/x86_macros.h index 72f5c29c7..5e83e66af 100644 --- a/public/jit/x86/x86_macros.h +++ b/public/jit/x86/x86_macros.h @@ -107,6 +107,7 @@ #define IA32_JCC_IMM32_1 0x0F // opcode part 1 #define IA32_JCC_IMM32_2 0x80 // encoding is +cc #define IA32_RET 0xC3 // no extra encoding +#define IA32_RETN 0xC2 // encoding is #define IA32_NEG_RM 0xF7 // encoding is /3 #define IA32_INC_REG 0x40 // encoding is +r #define IA32_INC_RM 0xFF // encoding is /0 @@ -1349,6 +1350,12 @@ inline void IA32_Return(JitWriter *jit) jit->write_ubyte(IA32_RET); } +inline void IA32_Return_Popstack(JitWriter *jit, unsigned short bytes) +{ + jit->write_ubyte(IA32_RETN); + jit->write_ushort(bytes); +} + inline void IA32_Test_Rm_Reg(JitWriter *jit, jit_uint8_t reg1, jit_uint8_t reg2, jit_uint8_t mode) { jit->write_ubyte(IA32_TEST_RM_REG);