This allows us to emit such instructions in case the opc is longer than one byte.
Signed-off-by: Eduard - Gabriel Munteanu <eduard.munte...@linux360.ro> --- arch/x86/emit-code.c | 30 ++++++++++++++++++++++++------ 1 files changed, 24 insertions(+), 6 deletions(-) diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c index 047e4b9..5f6e703 100644 --- a/arch/x86/emit-code.c +++ b/arch/x86/emit-code.c @@ -147,6 +147,14 @@ static inline void emit(struct buffer *buf, unsigned char c) assert(!err); } +static inline void emit_str(struct buffer *buf, unsigned char *str, size_t len) +{ + int err; + + err = append_buffer_str(buf, str, len); + assert(!err); +} + static void write_imm32(struct buffer *buf, unsigned long offset, long imm32) { unsigned char *buffer; @@ -2267,11 +2275,12 @@ static void emit_pop_reg(struct buffer *buf, struct operand *operand) __emit_pop_reg(buf, mach_reg(&operand->reg)); } -static void __emit_reg_reg(struct buffer *buf, - int rex_w, - unsigned char opc, - enum machine_reg direct_reg, - enum machine_reg rm_reg) +static void __emit_lopc_reg_reg(struct buffer *buf, + int rex_w, + unsigned char *lopc, + size_t lopc_size, + enum machine_reg direct_reg, + enum machine_reg rm_reg) { unsigned char rex_pfx = 0, mod_rm; unsigned char direct, rm; @@ -2290,10 +2299,19 @@ static void __emit_reg_reg(struct buffer *buf, if (rex_pfx) emit(buf, rex_pfx); - emit(buf, opc); + emit_str(buf, lopc, lopc_size); emit(buf, mod_rm); } +static inline void __emit_reg_reg(struct buffer *buf, + int rex_w, + unsigned char opc, + enum machine_reg direct_reg, + enum machine_reg rm_reg) +{ + __emit_lopc_reg_reg(buf, rex_w, &opc, 1, direct_reg, rm_reg); +} + static void emit_reg_reg(struct buffer *buf, int rex_w, unsigned char opc, -- 1.6.0.6 ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel