/[gxemul]/trunk/src/cpus/cpu_sparc.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/cpus/cpu_sparc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 27 by dpavlin, Mon Oct 8 16:20:10 2007 UTC revision 28 by dpavlin, Mon Oct 8 16:20:26 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $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 $
29   *   *
30   *  SPARC CPU emulation.   *  SPARC CPU emulation.
31   */   */
# Line 91  int sparc_cpu_new(struct cpu *cpu, struc Line 91  int sparc_cpu_new(struct cpu *cpu, struc
91          cpu->instruction_has_delayslot = sparc_cpu_instruction_has_delayslot;          cpu->instruction_has_delayslot = sparc_cpu_instruction_has_delayslot;
92    
93          if (cpu->is_32bit) {          if (cpu->is_32bit) {
94                    cpu->run_instr = sparc32_run_instr;
95                  cpu->update_translation_table =                  cpu->update_translation_table =
96                      sparc32_update_translation_table;                      sparc32_update_translation_table;
97                  cpu->invalidate_translation_caches =                  cpu->invalidate_translation_caches =
# Line 98  int sparc_cpu_new(struct cpu *cpu, struc Line 99  int sparc_cpu_new(struct cpu *cpu, struc
99                  cpu->invalidate_code_translation =                  cpu->invalidate_code_translation =
100                      sparc32_invalidate_code_translation;                      sparc32_invalidate_code_translation;
101          } else {          } else {
102                    cpu->run_instr = sparc_run_instr;
103                  cpu->update_translation_table = sparc_update_translation_table;                  cpu->update_translation_table = sparc_update_translation_table;
104                  cpu->invalidate_translation_caches =                  cpu->invalidate_translation_caches =
105                      sparc_invalidate_translation_caches;                      sparc_invalidate_translation_caches;
# Line 135  int sparc_cpu_new(struct cpu *cpu, struc Line 137  int sparc_cpu_new(struct cpu *cpu, struc
137          /*  Insert number of Windows and Trap levels into the version reg.:  */          /*  Insert number of Windows and Trap levels into the version reg.:  */
138          cpu->cd.sparc.ver |= MAXWIN | (MAXTL << SPARC_VER_MAXTL_SHIFT);          cpu->cd.sparc.ver |= MAXWIN | (MAXTL << SPARC_VER_MAXTL_SHIFT);
139    
140            /*  Misc. initial settings suitable for userland emulation:  */
141            cpu->cd.sparc.cansave = cpu->cd.sparc.cpu_type.nwindows - 1;
142            cpu->cd.sparc.cleanwin = cpu->cd.sparc.cpu_type.nwindows / 2;
143    
144            if (cpu->cd.sparc.cpu_type.nwindows >= MAXWIN) {
145                    fatal("Fatal internal error: nwindows = %1 is more than %i\n",
146                        cpu->cd.sparc.cpu_type.nwindows, MAXWIN);
147                    exit(1);
148            }
149    
150          return 1;          return 1;
151  }  }
152    
# Line 734  int sparc_cpu_disassemble_instr(struct c Line 746  int sparc_cpu_disassemble_instr(struct c
746                          if ((iword >> 13) & 1) {                          if ((iword >> 13) & 1) {
747                                  if (siconst >= -9 && siconst <= 9)                                  if (siconst >= -9 && siconst <= 9)
748                                          debug("%i", siconst);                                          debug("%i", siconst);
749                                    else if (siconst < 0 && (op2 == 0 ||
750                                        op2 == 4 || op2 == 20 || op2 == 60))
751                                            debug("-0x%x", -siconst);
752                                  else                                  else
753                                          debug("0x%x", siconst);                                          debug("0x%x", siconst);
754                          } else {                          } else {
# Line 746  int sparc_cpu_disassemble_instr(struct c Line 761  int sparc_cpu_disassemble_instr(struct c
761                          debug("%%%s", rd_name);                          debug("%%%s", rd_name);
762                  break;                  break;
763    
764          case 3: debug("%s\t", sparc_loadstore_names[op2]);          case 3: mnem = sparc_loadstore_names[op2];
765                    switch (op2) {
766                    case 0: /*  'lduw' was called only 'ld' in pre-v9  */
767                            if (cpu->cd.sparc.cpu_type.v < 9)
768                                    mnem = "ld";
769                            break;
770                    }
771                    debug("%s\t", mnem);
772                  if (op2 & 4)                  if (op2 & 4)
773                          debug("%%%s,", sparc_regnames[rd]);                          debug("%%%s,", sparc_regnames[rd]);
774                  debug("[%%%s", sparc_regnames[rs1]);                  debug("[%%%s", sparc_regnames[rs1]);
# Line 760  int sparc_cpu_disassemble_instr(struct c Line 782  int sparc_cpu_disassemble_instr(struct c
782                                  debug("+%%%s", sparc_regnames[rs2]);                                  debug("+%%%s", sparc_regnames[rs2]);
783                  }                  }
784                  debug("]");                  debug("]");
785                  if (asi != 0)                  if ((op2 & 0x30) == 0x10)
786                          debug("(%i)", asi);                          debug("(%i)", asi);
787                  if (!(op2 & 4))                  if (!(op2 & 4))
788                          debug(",%%%s", sparc_regnames[rd]);                          debug(",%%%s", sparc_regnames[rd]);

Legend:
Removed from v.27  
changed lines
  Added in v.28

  ViewVC Help
Powered by ViewVC 1.1.26