--- trunk/src/cpus/cpu_sparc.c 2007/10/08 16:20:18 27 +++ trunk/src/cpus/cpu_sparc.c 2007/10/08 16:20:26 28 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: cpu_sparc.c,v 1.31 2006/06/24 21:47:23 debug Exp $ + * $Id: cpu_sparc.c,v 1.34 2006/07/16 13:32:26 debug Exp $ * * SPARC CPU emulation. */ @@ -91,6 +91,7 @@ cpu->instruction_has_delayslot = sparc_cpu_instruction_has_delayslot; if (cpu->is_32bit) { + cpu->run_instr = sparc32_run_instr; cpu->update_translation_table = sparc32_update_translation_table; cpu->invalidate_translation_caches = @@ -98,6 +99,7 @@ cpu->invalidate_code_translation = sparc32_invalidate_code_translation; } else { + cpu->run_instr = sparc_run_instr; cpu->update_translation_table = sparc_update_translation_table; cpu->invalidate_translation_caches = sparc_invalidate_translation_caches; @@ -135,6 +137,16 @@ /* Insert number of Windows and Trap levels into the version reg.: */ cpu->cd.sparc.ver |= MAXWIN | (MAXTL << SPARC_VER_MAXTL_SHIFT); + /* Misc. initial settings suitable for userland emulation: */ + cpu->cd.sparc.cansave = cpu->cd.sparc.cpu_type.nwindows - 1; + cpu->cd.sparc.cleanwin = cpu->cd.sparc.cpu_type.nwindows / 2; + + if (cpu->cd.sparc.cpu_type.nwindows >= MAXWIN) { + fatal("Fatal internal error: nwindows = %1 is more than %i\n", + cpu->cd.sparc.cpu_type.nwindows, MAXWIN); + exit(1); + } + return 1; } @@ -734,6 +746,9 @@ if ((iword >> 13) & 1) { if (siconst >= -9 && siconst <= 9) debug("%i", siconst); + else if (siconst < 0 && (op2 == 0 || + op2 == 4 || op2 == 20 || op2 == 60)) + debug("-0x%x", -siconst); else debug("0x%x", siconst); } else { @@ -746,7 +761,14 @@ debug("%%%s", rd_name); break; - case 3: debug("%s\t", sparc_loadstore_names[op2]); + case 3: mnem = sparc_loadstore_names[op2]; + switch (op2) { + case 0: /* 'lduw' was called only 'ld' in pre-v9 */ + if (cpu->cd.sparc.cpu_type.v < 9) + mnem = "ld"; + break; + } + debug("%s\t", mnem); if (op2 & 4) debug("%%%s,", sparc_regnames[rd]); debug("[%%%s", sparc_regnames[rs1]); @@ -760,7 +782,7 @@ debug("+%%%s", sparc_regnames[rs2]); } debug("]"); - if (asi != 0) + if ((op2 & 0x30) == 0x10) debug("(%i)", asi); if (!(op2 & 4)) debug(",%%%s", sparc_regnames[rd]);