X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=cpu%2Fdrc%2Femit_x86.c;h=754c27fe1a4c1ef227cf69cdd1bc50936dfcd834;hb=9db6a54485501b56b0f2f5db4d093c38fe495bda;hp=3624f5c3f1c55cb14d4b430069de5536f583622d;hpb=04092e329bbd050073d42defcd609550d8545e74;p=picodrive.git diff --git a/cpu/drc/emit_x86.c b/cpu/drc/emit_x86.c index 3624f5c..754c27f 100644 --- a/cpu/drc/emit_x86.c +++ b/cpu/drc/emit_x86.c @@ -1,4 +1,10 @@ /* + * Basic macros to emit x86 instructions and some utils + * Copyright (C) 2008,2009,2010 notaz + * + * This work is licensed under the terms of MAME license. + * See COPYING file in the top-level directory. + * * note: * temp registers must be eax-edx due to use of SETcc and r/w 8/16. * note about silly things like emith_eor_r_r_r: @@ -139,6 +145,17 @@ enum { xAX = 0, xCX, xDX, xBX, xSP, xBP, xSI, xDI }; } // _r_r_r +#define emith_add_r_r_r(d, s1, s2) { \ + if (d == s1) { \ + emith_add_r_r(d, s2); \ + } else if (d == s2) { \ + emith_add_r_r(d, s1); \ + } else { \ + emith_move_r_r(d, s1); \ + emith_add_r_r(d, s2); \ + } \ +} + #define emith_eor_r_r_r(d, s1, s2) { \ if (d == s1) { \ emith_eor_r_r(d, s2); \ @@ -612,14 +629,13 @@ enum { xAX = 0, xCX, xDX, xBX, xSP, xBP, xSI, xDI }; } // assumes EBX is free temporary -#define emith_sh2_wcall(a, tab, ret_ptr) { \ +#define emith_sh2_wcall(a, tab) { \ int arg2_; \ host_arg2reg(arg2_, 2); \ emith_lsr(xBX, a, SH2_WRITE_SHIFT); \ EMIT_OP_MODRM(0x8b, 0, xBX, 4); \ EMIT_SIB(2, xBX, tab); /* mov ebx, [tab + ebx * 4] */ \ - emith_ctx_read(arg2_, offsetof(SH2, is_slave)); \ - emith_push_imm((long)(ret_ptr)); \ + emith_move_r_r(arg2_, CONTEXT_REG); \ emith_jump_reg(xBX); \ }