📄 ppc32_x86_trans.c
字号:
ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(ba)); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(bb)); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(bd)); iop = ppc32_op_emit_insn_output(cpu,3,"crand"); /* test $ba bit */ x86_test_membase_imm(iop->ob_ptr, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(ba)), (1 << ppc32_get_cr_bit(ba))); x86_set_reg(iop->ob_ptr,X86_CC_NZ,X86_EDX,FALSE); /* test $bb bit */ x86_test_membase_imm(iop->ob_ptr, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bb)), (1 << ppc32_get_cr_bit(bb))); x86_set_reg(iop->ob_ptr,X86_CC_NZ,hreg_t0,FALSE); /* result of AND between $ba and $bb */ x86_alu_reg_reg(iop->ob_ptr,X86_AND,hreg_t0,X86_EDX); x86_alu_reg_imm(iop->ob_ptr,X86_AND,hreg_t0,0x01); /* set/clear $bd bit depending on the result */ x86_alu_membase_imm(iop->ob_ptr,X86_AND, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bd)), ~(1 << ppc32_get_cr_bit(bd))); x86_shift_reg_imm(iop->ob_ptr,X86_SHL,hreg_t0,ppc32_get_cr_bit(bd)); x86_alu_membase_reg(iop->ob_ptr,X86_OR, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bd)), hreg_t0); ppc32_jit_close_hreg_seq(cpu); return(0);}/* CRANDC - Condition Register AND with Complement */DECLARE_INSN(CRANDC){ int bd = bits(insn,21,25); int bb = bits(insn,16,20); int ba = bits(insn,11,15); int hreg_t0; jit_op_t *iop; ppc32_op_emit_alter_host_reg(cpu,X86_EDX); ppc32_jit_start_hreg_seq(cpu,"crandc"); hreg_t0 = ppc32_jit_get_tmp_hreg(cpu); ppc32_jit_alloc_hreg_forced(cpu,X86_EDX); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(ba)); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(bb)); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(bd)); iop = ppc32_op_emit_insn_output(cpu,3,"crandc"); /* test $ba bit */ x86_test_membase_imm(iop->ob_ptr, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(ba)), (1 << ppc32_get_cr_bit(ba))); x86_set_reg(iop->ob_ptr,X86_CC_NZ,X86_EDX,FALSE); /* test $bb bit */ x86_test_membase_imm(iop->ob_ptr, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bb)), (1 << ppc32_get_cr_bit(bb))); x86_set_reg(iop->ob_ptr,X86_CC_Z,hreg_t0,FALSE); /* result of AND between $ba and $bb */ x86_alu_reg_reg(iop->ob_ptr,X86_AND,hreg_t0,X86_EDX); x86_alu_reg_imm(iop->ob_ptr,X86_AND,hreg_t0,0x01); /* set/clear $bd bit depending on the result */ x86_alu_membase_imm(iop->ob_ptr,X86_AND, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bd)), ~(1 << ppc32_get_cr_bit(bd))); x86_shift_reg_imm(iop->ob_ptr,X86_SHL,hreg_t0,ppc32_get_cr_bit(bd)); x86_alu_membase_reg(iop->ob_ptr,X86_OR, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bd)), hreg_t0); ppc32_jit_close_hreg_seq(cpu); return(0);}/* CREQV - Condition Register EQV */DECLARE_INSN(CREQV){ int bd = bits(insn,21,25); int bb = bits(insn,16,20); int ba = bits(insn,11,15); int hreg_t0; jit_op_t *iop; ppc32_op_emit_alter_host_reg(cpu,X86_EDX); ppc32_jit_start_hreg_seq(cpu,"creqv"); hreg_t0 = ppc32_jit_get_tmp_hreg(cpu); ppc32_jit_alloc_hreg_forced(cpu,X86_EDX); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(ba)); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(bb)); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(bd)); iop = ppc32_op_emit_insn_output(cpu,3,"creqv"); /* test $ba bit */ x86_test_membase_imm(iop->ob_ptr, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(ba)), (1 << ppc32_get_cr_bit(ba))); x86_set_reg(iop->ob_ptr,X86_CC_NZ,X86_EDX,FALSE); /* test $bb bit */ x86_test_membase_imm(iop->ob_ptr, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bb)), (1 << ppc32_get_cr_bit(bb))); x86_set_reg(iop->ob_ptr,X86_CC_NZ,hreg_t0,FALSE); /* result of XOR between $ba and $bb */ x86_alu_reg_reg(iop->ob_ptr,X86_XOR,hreg_t0,X86_EDX); x86_not_reg(iop->ob_ptr,hreg_t0); x86_alu_reg_imm(iop->ob_ptr,X86_AND,hreg_t0,0x01); /* set/clear $bd bit depending on the result */ x86_alu_membase_imm(iop->ob_ptr,X86_AND, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bd)), ~(1 << ppc32_get_cr_bit(bd))); x86_shift_reg_imm(iop->ob_ptr,X86_SHL,hreg_t0,ppc32_get_cr_bit(bd)); x86_alu_membase_reg(iop->ob_ptr,X86_OR, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bd)), hreg_t0); ppc32_jit_close_hreg_seq(cpu); return(0);}/* CRNAND - Condition Register NAND */DECLARE_INSN(CRNAND){ int bd = bits(insn,21,25); int bb = bits(insn,16,20); int ba = bits(insn,11,15); int hreg_t0; jit_op_t *iop; ppc32_op_emit_alter_host_reg(cpu,X86_EDX); ppc32_jit_start_hreg_seq(cpu,"crnand"); hreg_t0 = ppc32_jit_get_tmp_hreg(cpu); ppc32_jit_alloc_hreg_forced(cpu,X86_EDX); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(ba)); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(bb)); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(bd)); iop = ppc32_op_emit_insn_output(cpu,3,"crnand"); /* test $ba bit */ x86_test_membase_imm(iop->ob_ptr, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(ba)), (1 << ppc32_get_cr_bit(ba))); x86_set_reg(iop->ob_ptr,X86_CC_NZ,X86_EDX,FALSE); /* test $bb bit */ x86_test_membase_imm(iop->ob_ptr, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bb)), (1 << ppc32_get_cr_bit(bb))); x86_set_reg(iop->ob_ptr,X86_CC_NZ,hreg_t0,FALSE); /* result of NAND between $ba and $bb */ x86_alu_reg_reg(iop->ob_ptr,X86_AND,hreg_t0,X86_EDX); x86_not_reg(iop->ob_ptr,hreg_t0); x86_alu_reg_imm(iop->ob_ptr,X86_AND,hreg_t0,0x01); /* set/clear $bd bit depending on the result */ x86_alu_membase_imm(iop->ob_ptr,X86_AND, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bd)), ~(1 << ppc32_get_cr_bit(bd))); x86_shift_reg_imm(iop->ob_ptr,X86_SHL,hreg_t0,ppc32_get_cr_bit(bd)); x86_alu_membase_reg(iop->ob_ptr,X86_OR, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bd)), hreg_t0); ppc32_jit_close_hreg_seq(cpu); return(0);}/* CRNOR - Condition Register NOR */DECLARE_INSN(CRNOR){ int bd = bits(insn,21,25); int bb = bits(insn,16,20); int ba = bits(insn,11,15); int hreg_t0; jit_op_t *iop; ppc32_op_emit_alter_host_reg(cpu,X86_EDX); ppc32_jit_start_hreg_seq(cpu,"crnor"); hreg_t0 = ppc32_jit_get_tmp_hreg(cpu); ppc32_jit_alloc_hreg_forced(cpu,X86_EDX); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(ba)); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(bb)); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(bd)); iop = ppc32_op_emit_insn_output(cpu,3,"crnor"); /* test $ba bit */ x86_test_membase_imm(iop->ob_ptr, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(ba)), (1 << ppc32_get_cr_bit(ba))); x86_set_reg(iop->ob_ptr,X86_CC_NZ,X86_EDX,FALSE); /* test $bb bit */ x86_test_membase_imm(iop->ob_ptr, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bb)), (1 << ppc32_get_cr_bit(bb))); x86_set_reg(iop->ob_ptr,X86_CC_NZ,hreg_t0,FALSE); /* result of NOR between $ba and $bb */ x86_alu_reg_reg(iop->ob_ptr,X86_OR,hreg_t0,X86_EDX); x86_not_reg(iop->ob_ptr,hreg_t0); x86_alu_reg_imm(iop->ob_ptr,X86_AND,hreg_t0,0x01); /* set/clear $bd bit depending on the result */ x86_alu_membase_imm(iop->ob_ptr,X86_AND, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bd)), ~(1 << ppc32_get_cr_bit(bd))); x86_shift_reg_imm(iop->ob_ptr,X86_SHL,hreg_t0,ppc32_get_cr_bit(bd)); x86_alu_membase_reg(iop->ob_ptr,X86_OR, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bd)), hreg_t0); ppc32_jit_close_hreg_seq(cpu); return(0);}/* CROR - Condition Register OR */DECLARE_INSN(CROR){ int bd = bits(insn,21,25); int bb = bits(insn,16,20); int ba = bits(insn,11,15); int hreg_t0; jit_op_t *iop; ppc32_op_emit_alter_host_reg(cpu,X86_EDX); ppc32_jit_start_hreg_seq(cpu,"cror"); hreg_t0 = ppc32_jit_get_tmp_hreg(cpu); ppc32_jit_alloc_hreg_forced(cpu,X86_EDX); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(ba)); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(bb)); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(bd)); iop = ppc32_op_emit_insn_output(cpu,3,"cror"); /* test $ba bit */ x86_test_membase_imm(iop->ob_ptr, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(ba)), (1 << ppc32_get_cr_bit(ba))); x86_set_reg(iop->ob_ptr,X86_CC_NZ,X86_EDX,FALSE); /* test $bb bit */ x86_test_membase_imm(iop->ob_ptr, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bb)), (1 << ppc32_get_cr_bit(bb))); x86_set_reg(iop->ob_ptr,X86_CC_NZ,hreg_t0,FALSE); /* result of OR between $ba and $bb */ x86_alu_reg_reg(iop->ob_ptr,X86_OR,hreg_t0,X86_EDX); x86_alu_reg_imm(iop->ob_ptr,X86_AND,hreg_t0,0x01); /* set/clear $bd bit depending on the result */ x86_alu_membase_imm(iop->ob_ptr,X86_AND, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bd)), ~(1 << ppc32_get_cr_bit(bd))); x86_shift_reg_imm(iop->ob_ptr,X86_SHL,hreg_t0,ppc32_get_cr_bit(bd)); x86_alu_membase_reg(iop->ob_ptr,X86_OR, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bd)), hreg_t0); ppc32_jit_close_hreg_seq(cpu); return(0);}/* CRORC - Condition Register OR with Complement */DECLARE_INSN(CRORC){ int bd = bits(insn,21,25); int bb = bits(insn,16,20); int ba = bits(insn,11,15); int hreg_t0; jit_op_t *iop; ppc32_op_emit_alter_host_reg(cpu,X86_EDX); ppc32_jit_start_hreg_seq(cpu,"crorc"); hreg_t0 = ppc32_jit_get_tmp_hreg(cpu); ppc32_jit_alloc_hreg_forced(cpu,X86_EDX); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(ba)); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(bb)); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(bd)); iop = ppc32_op_emit_insn_output(cpu,3,"crorc"); /* test $ba bit */ x86_test_membase_imm(iop->ob_ptr, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(ba)), (1 << ppc32_get_cr_bit(ba))); x86_set_reg(iop->ob_ptr,X86_CC_NZ,X86_EDX,FALSE); /* test $bb bit */ x86_test_membase_imm(iop->ob_ptr, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bb)), (1 << ppc32_get_cr_bit(bb))); x86_set_reg(iop->ob_ptr,X86_CC_Z,hreg_t0,FALSE); /* result of ORC between $ba and $bb */ x86_alu_reg_reg(iop->ob_ptr,X86_OR,hreg_t0,X86_EDX); x86_alu_reg_imm(iop->ob_ptr,X86_AND,hreg_t0,0x01); /* set/clear $bd bit depending on the result */ x86_alu_membase_imm(iop->ob_ptr,X86_AND, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bd)), ~(1 << ppc32_get_cr_bit(bd))); x86_shift_reg_imm(iop->ob_ptr,X86_SHL,hreg_t0,ppc32_get_cr_bit(bd)); x86_alu_membase_reg(iop->ob_ptr,X86_OR, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bd)), hreg_t0); ppc32_jit_close_hreg_seq(cpu); return(0);}/* CRXOR - Condition Register XOR */DECLARE_INSN(CRXOR){ int bd = bits(insn,21,25); int bb = bits(insn,16,20); int ba = bits(insn,11,15); int hreg_t0; jit_op_t *iop; ppc32_op_emit_alter_host_reg(cpu,X86_EDX); ppc32_jit_start_hreg_seq(cpu,"crxor"); hreg_t0 = ppc32_jit_get_tmp_hreg(cpu); ppc32_jit_alloc_hreg_forced(cpu,X86_EDX); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(ba)); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(bb)); ppc32_op_emit_require_flags(cpu,ppc32_get_cr_field(bd)); iop = ppc32_op_emit_insn_output(cpu,3,"crxor"); /* test $ba bit */ x86_test_membase_imm(iop->ob_ptr, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(ba)), (1 << ppc32_get_cr_bit(ba))); x86_set_reg(iop->ob_ptr,X86_CC_NZ,X86_EDX,FALSE); /* test $bb bit */ x86_test_membase_imm(iop->ob_ptr, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bb)), (1 << ppc32_get_cr_bit(bb))); x86_set_reg(iop->ob_ptr,X86_CC_NZ,hreg_t0,FALSE); /* result of XOR between $ba and $bb */ x86_alu_reg_reg(iop->ob_ptr,X86_XOR,hreg_t0,X86_EDX); x86_alu_reg_imm(iop->ob_ptr,X86_AND,hreg_t0,0x01); /* set/clear $bd bit depending on the result */ x86_alu_membase_imm(iop->ob_ptr,X86_AND, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bd)), ~(1 << ppc32_get_cr_bit(bd))); x86_shift_reg_imm(iop->ob_ptr,X86_SHL,hreg_t0,ppc32_get_cr_bit(bd)); x86_alu_membase_reg(iop->ob_ptr,X86_OR, X86_EDI,PPC32_CR_FIELD_OFFSET(ppc32_get_cr_field(bd)), hreg_t0); ppc32_jit_close_hreg_seq(cpu); return(0);}/* DIVWU - Divide Word Unsigned */DECLARE_INSN(DIVWU){ int rd = bits(insn,21,25); int ra = bits(insn,16,20); int rb = bits(insn,11,15); int hreg_rb; jit_op_t *iop; ppc32_jit_start_hreg_seq(cpu,"divwu"); ppc32_jit_alloc_hreg_forced(cpu,X86_EAX); ppc32_jit_alloc_hreg_forced(cpu,X86_EDX); hreg_rb = ppc32_jit_alloc_hreg(cpu,rb); /* $rd = $ra / $rb */ ppc32_op_emit_load_gpr(cpu,X86_EAX,ra); ppc32_op_emit_load_gpr(cpu,hreg_rb,rb); iop = ppc32_op_emit_insn_output(cpu,2,"divwu"); ppc32_load_imm(&iop->ob_ptr,X86_EDX,0); x86_div_reg(iop->ob_ptr,hreg_rb,0); if (insn & 1) x86_test_reg_reg(iop->ob_ptr,X86_EAX,X86_EAX); ppc32_op_emit_store_gpr(cpu,rd,X86_EAX); if (insn & 1) ppc32_op_emit_update_flags(cpu,0,TRUE); /* edx:eax are directly modified: throw them */ ppc32_op_emit_alter_host_reg(cpu,X86_EAX); ppc32_op_emit_alter_host_reg(cpu,X86_EDX); ppc32_jit_close_hreg_seq(cpu); return(0);}/* EQV */DECLARE_INSN(EQV){ int rs = bits(insn,21,25); int ra = bits
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -