--- trunk/src/cpus/cpu_ppc_instr.c 2007/10/08 16:22:20 41 +++ trunk/src/cpus/cpu_ppc_instr.c 2007/10/08 16:22:32 42 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: cpu_ppc_instr.c,v 1.73 2007/02/17 10:06:19 debug Exp $ + * $Id: cpu_ppc_instr.c,v 1.75 2007/06/15 06:26:20 debug Exp $ * * POWER/PowerPC instructions. * @@ -190,7 +190,7 @@ cpu->cd.ppc.spr[SPR_CTR] --; ctr_ok = (bo >> 2) & 1; tmp = cpu->cd.ppc.spr[SPR_CTR]; - ctr_ok |= ( (tmp != 0) ^ ((bo >> 1) & 1) ); + ctr_ok |= ( (tmp == 0) == ((bo >> 1) & 1) ); cond_ok = (bo >> 4) & 1; cond_ok |= ( ((bo >> 3) & 1) == ((cpu->cd.ppc.cr >> bi31m) & 1) ); if (ctr_ok && cond_ok) { @@ -228,7 +228,7 @@ cpu->cd.ppc.spr[SPR_CTR] --; ctr_ok = (bo >> 2) & 1; tmp = cpu->cd.ppc.spr[SPR_CTR]; - ctr_ok |= ( (tmp != 0) ^ ((bo >> 1) & 1) ); + ctr_ok |= ( (tmp == 0) == ((bo >> 1) & 1) ); cond_ok = (bo >> 4) & 1; cond_ok |= ( ((bo >> 3) & 1) == ((cpu->cd.ppc.cr >> bi31m) & 1) ); @@ -272,7 +272,7 @@ */ X(bcctr) { - unsigned int bo = ic->arg[0], bi31m = ic->arg[1] /*,bh = ic->arg[2]*/; + unsigned int bo = ic->arg[0], bi31m = ic->arg[1]; uint64_t old_pc = cpu->pc; MODE_uint_t addr = cpu->cd.ppc.spr[SPR_CTR]; int cond_ok = (bo >> 4) & 1; @@ -369,7 +369,7 @@ cpu->cd.ppc.spr[SPR_CTR] --; ctr_ok = (bo >> 2) & 1; tmp = cpu->cd.ppc.spr[SPR_CTR]; - ctr_ok |= ( (tmp != 0) ^ ((bo >> 1) & 1) ); + ctr_ok |= ( (tmp == 0) == ((bo >> 1) & 1) ); cond_ok = (bo >> 4) & 1; cond_ok |= ( ((bo >> 3) & 1) == ((cpu->cd.ppc.cr >> (bi31m)) & 1) ); @@ -393,7 +393,7 @@ cpu->cd.ppc.spr[SPR_CTR] --; ctr_ok = (bo >> 2) & 1; tmp = cpu->cd.ppc.spr[SPR_CTR]; - ctr_ok |= ( (tmp != 0) ^ ((bo >> 1) & 1) ); + ctr_ok |= ( (tmp == 0) == ((bo >> 1) & 1) ); cond_ok = (bo >> 4) & 1; cond_ok |= ( ((bo >> 3) & 1) == ((cpu->cd.ppc.cr >> bi31m) & 1) ); @@ -428,7 +428,7 @@ cpu->cd.ppc.spr[SPR_CTR] --; ctr_ok = (bo >> 2) & 1; tmp = cpu->cd.ppc.spr[SPR_CTR]; - ctr_ok |= ( (tmp != 0) ^ ((bo >> 1) & 1) ); + ctr_ok |= ( (tmp == 0) == ((bo >> 1) & 1) ); cond_ok = (bo >> 4) & 1; cond_ok |= ( ((bo >> 3) & 1) == ((cpu->cd.ppc.cr >> bi31m) & 1) ); @@ -464,7 +464,7 @@ cpu->cd.ppc.spr[SPR_CTR] --; ctr_ok = (bo >> 2) & 1; tmp = cpu->cd.ppc.spr[SPR_CTR]; - ctr_ok |= ( (tmp != 0) ^ ((bo >> 1) & 1) ); + ctr_ok |= ( (tmp == 0) == ((bo >> 1) & 1) ); cond_ok = (bo >> 4) & 1; cond_ok |= ( ((bo >> 3) & 1) == ((cpu->cd.ppc.cr >> bi31m) & 1) ); @@ -2766,8 +2766,9 @@ ic->arg[1] = 19; ic->arg[2] = 19; } else { - fatal("[ TODO: Unimplemented ALTIVEC, iword" - " = 0x%08"PRIx32"x ]\n", iword); + if (!cpu->translation_readahead) + fatal("[ TODO: Unimplemented ALTIVEC, iword" + " = 0x%08"PRIx32"x ]\n", iword); goto bad; } break; @@ -2822,7 +2823,8 @@ case PPC_HI6_ADDIC: case PPC_HI6_ADDIC_DOT: if (cpu->cd.ppc.bits == 64) { - fatal("addic for 64-bit: TODO\n"); + if (!cpu->translation_readahead) + fatal("addic for 64-bit: TODO\n"); goto bad; } rt = (iword >> 21) & 31; @@ -2940,7 +2942,8 @@ + 32*update]; } if (ra == 0 && update) { - fatal("TODO: ra=0 && update?\n"); + if (!cpu->translation_readahead) + fatal("TODO: ra=0 && update?\n"); goto bad; } if (fp) @@ -2961,7 +2964,8 @@ bi = (iword >> 16) & 31; tmp_addr = (int64_t)(int16_t)(iword & 0xfffc); if (aa_bit) { - fatal("aa_bit: NOT YET\n"); + if (!cpu->translation_readahead) + fatal("aa_bit: NOT YET\n"); goto bad; } if (lk_bit) { @@ -3076,6 +3080,12 @@ ic->f = instr(bclr_20); } } else { + if (!(bo & 4)) { + if (!cpu->translation_readahead) + fatal("TODO: bclr/bcctr " + "bo bit 2 clear!\n"); + goto bad; + } if (lk_bit) ic->f = instr(bcctr_l); else @@ -3198,7 +3208,8 @@ } ic->arg[0] = iword; if (cpu->cd.ppc.bits == 32) { - fatal("TODO: rld* in 32-bit mode?\n"); + if (!cpu->translation_readahead) + fatal("TODO: rld* in 32-bit mode?\n"); goto bad; } break; @@ -3242,7 +3253,8 @@ ra = (iword >> 16) & 31; rc = iword & 1; if (rc) { - fatal("TODO: rc\n"); + if (!cpu->translation_readahead) + fatal("TODO: rc\n"); goto bad; } ic->arg[0] = (size_t)(&cpu->cd.ppc.gpr[rs]); @@ -3296,7 +3308,8 @@ rs = (iword >> 21) & 31; l_bit = (iword >> 16) & 1; if (l_bit) { - fatal("TODO: mtmsr l-bit\n"); + if (!cpu->translation_readahead) + fatal("TODO: mtmsr l-bit\n"); goto bad; } ic->arg[0] = (size_t)(&cpu->cd.ppc.gpr[rs]); @@ -3332,7 +3345,8 @@ case PPC_31_MTSRIN: ic->f = instr(mtsrin); break; } if (cpu->cd.ppc.bits == 64) { - fatal("Not yet for 64-bit mode\n"); + if (!cpu->translation_readahead) + fatal("Not yet for 64-bit mode\n"); goto bad; } break; @@ -3347,7 +3361,8 @@ case PPC_31_MTSR: ic->f = instr(mtsr); break; } if (cpu->cd.ppc.bits == 64) { - fatal("Not yet for 64-bit mode\n"); + if (!cpu->translation_readahead) + fatal("Not yet for 64-bit mode\n"); goto bad; } break; @@ -3432,7 +3447,8 @@ switch (spr) { case 268: ic->f = instr(mftb); break; case 269: ic->f = instr(mftbu); break; - default:fatal("mftb spr=%i?\n", spr); + default:if (!cpu->translation_readahead) + fatal("mftb spr=%i?\n", spr); goto bad; } break; @@ -3567,7 +3583,8 @@ [size + 4*zero + 8*load + 16*update]; } if (ra == 0 && update) { - fatal("TODO: ra=0 && update?\n"); + if (!cpu->translation_readahead) + fatal("TODO: ra=0 && update?\n"); goto bad; } break; @@ -3653,7 +3670,8 @@ oe_bit = (iword >> 10) & 1; rc = iword & 1; if (oe_bit) { - fatal("oe_bit not yet implemented\n"); + if (!cpu->translation_readahead) + fatal("oe_bit not yet implemented\n"); goto bad; } switch (xo) { @@ -3703,7 +3721,9 @@ ic->f = instr(subfme_dot); break; case PPC_31_SUBFZE: ic->f = instr(subfze_dot); break; - default:fatal("RC bit not yet implemented\n"); + default:if (!cpu->translation_readahead) + fatal("RC bit not yet " + "implemented\n"); goto bad; } } @@ -3711,7 +3731,8 @@ ic->arg[1] = (size_t)(&cpu->cd.ppc.gpr[rb]); ic->arg[2] = (size_t)(&cpu->cd.ppc.gpr[rt]); if (cpu->cd.ppc.bits == 64 && n64) { - fatal("Not yet for 64-bit mode\n"); + if (!cpu->translation_readahead) + fatal("Not yet for 64-bit mode\n"); goto bad; } break; @@ -3751,7 +3772,9 @@ rc = iword & 1; if (rc) { - fatal("Floating point (59) with rc bit! TODO\n"); + if (!cpu->translation_readahead) + fatal("Floating point (59) " + "with rc bit! TODO\n"); goto bad; } @@ -3792,7 +3815,9 @@ rc = iword & 1; if (rc) { - fatal("Floating point (63) with rc bit! TODO\n"); + if (!cpu->translation_readahead) + fatal("Floating point (63) " + "with rc bit! TODO\n"); goto bad; }