void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOOPE_Jb(bxInstruction_c *i) { // it is impossible to get this instruction in long mode BX_ASSERT(i->as64L() == 0); Bit32u count; #if BX_CPU_LEVEL >= 3 if (i->as32L()) count = ECX; else #endif count = CX; count--; if ((count!=0) && get_ZF()) { Bit32u new_EIP = EIP + (Bit32s) i->Id(); if (i->os32L()==0) new_EIP &= 0x0000ffff; branch_near32(new_EIP); BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP); } #if BX_INSTRUMENTATION else { BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID); } #endif if (i->as32L()) ECX--; else CX--; }
void bx_cpu_c::JCC_Jd(BxInstruction_t *i) { Boolean condition = 0; switch (i->b1 & 0x0f) { case 0x00: /* JO */ condition = get_OF(); break; case 0x01: /* JNO */ condition = !get_OF(); break; case 0x02: /* JB */ condition = get_CF(); break; case 0x03: /* JNB */ condition = !get_CF(); break; case 0x04: /* JZ */ condition = get_ZF(); break; case 0x05: /* JNZ */ condition = !get_ZF(); break; case 0x06: /* JBE */ condition = get_CF() || get_ZF(); break; case 0x07: /* JNBE */ condition = !get_CF() && !get_ZF(); break; case 0x08: /* JS */ condition = get_SF(); break; case 0x09: /* JNS */ condition = !get_SF(); break; case 0x0A: /* JP */ condition = get_PF(); break; case 0x0B: /* JNP */ condition = !get_PF(); break; case 0x0C: /* JL */ condition = get_SF() != get_OF(); break; case 0x0D: /* JNL */ condition = get_SF() == get_OF(); break; case 0x0E: /* JLE */ condition = get_ZF() || (get_SF() != get_OF()); break; case 0x0F: /* JNLE */ condition = (get_SF() == get_OF()) && !get_ZF(); break; } if (condition) { Bit32u new_EIP; new_EIP = EIP + (Bit32s) i->Id; #if BX_CPU_LEVEL >= 2 if (protected_mode()) { if ( new_EIP > bx_cpu. sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled ) { BX_PANIC(("jo_routine: offset outside of CS limits")); exception(BX_GP_EXCEPTION, 0, 0); } } #endif EIP = new_EIP; BX_INSTR_CNEAR_BRANCH_TAKEN(new_EIP); revalidate_prefetch_q(); } #if BX_INSTRUMENTATION else { BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(); } #endif }
void BX_CPP_AttrRegparmN(1) BX_CPU_C::JCXZ_Jb(bxInstruction_c *i) { // it is impossible to get this instruction in long mode BX_ASSERT(i->as64L() == 0); Bit32u temp_ECX; if (i->as32L()) temp_ECX = ECX; else temp_ECX = CX; if (temp_ECX == 0) { Bit32u new_EIP = EIP + (Bit32s) i->Id(); if (i->os32L()==0) new_EIP &= 0x0000ffff; branch_near32(new_EIP); BX_INSTR_CNEAR_BRANCH_TAKEN(BX_CPU_ID, new_EIP); return; } BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(BX_CPU_ID); }