/[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 26 by dpavlin, Mon Oct 8 16:20:10 2007 UTC revision 30 by dpavlin, Mon Oct 8 16:20:40 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.35 2006/07/23 12:40:24 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 663  int sparc_cpu_disassemble_instr(struct c Line 675  int sparc_cpu_disassemble_instr(struct c
675                  case 41:rs_name = "psr";                  case 41:rs_name = "psr";
676                          no_rs2 = 1;                          no_rs2 = 1;
677                          break;                          break;
678                  case 42:rs_name = "wim";                  case 42:/*  TODO: something with wim only, on sparc v8?  */
679                            rs_name = sparc_pregnames[rs1];
680                          no_rs2 = 1;                          no_rs2 = 1;
681                          break;                          break;
682                  case 43:/*  ?  */                  case 43:/*  ?  */
# Line 734  int sparc_cpu_disassemble_instr(struct c Line 747  int sparc_cpu_disassemble_instr(struct c
747                          if ((iword >> 13) & 1) {                          if ((iword >> 13) & 1) {
748                                  if (siconst >= -9 && siconst <= 9)                                  if (siconst >= -9 && siconst <= 9)
749                                          debug("%i", siconst);                                          debug("%i", siconst);
750                                    else if (siconst < 0 && (op2 == 0 ||
751                                        op2 == 4 || op2 == 20 || op2 == 60))
752                                            debug("-0x%x", -siconst);
753                                  else                                  else
754                                          debug("0x%x", siconst);                                          debug("0x%x", siconst);
755                          } else {                          } else {
# Line 746  int sparc_cpu_disassemble_instr(struct c Line 762  int sparc_cpu_disassemble_instr(struct c
762                          debug("%%%s", rd_name);                          debug("%%%s", rd_name);
763                  break;                  break;
764    
765          case 3: debug("%s\t", sparc_loadstore_names[op2]);          case 3: mnem = sparc_loadstore_names[op2];
766                    switch (op2) {
767                    case 0: /*  'lduw' was called only 'ld' in pre-v9  */
768                            if (cpu->cd.sparc.cpu_type.v < 9)
769                                    mnem = "ld";
770                            break;
771                    }
772                    debug("%s\t", mnem);
773                  if (op2 & 4)                  if (op2 & 4)
774                          debug("%%%s,", sparc_regnames[rd]);                          debug("%%%s,", sparc_regnames[rd]);
775                  debug("[%%%s", sparc_regnames[rs1]);                  debug("[%%%s", sparc_regnames[rs1]);
# Line 760  int sparc_cpu_disassemble_instr(struct c Line 783  int sparc_cpu_disassemble_instr(struct c
783                                  debug("+%%%s", sparc_regnames[rs2]);                                  debug("+%%%s", sparc_regnames[rs2]);
784                  }                  }
785                  debug("]");                  debug("]");
786                  if (asi != 0)                  if ((op2 & 0x30) == 0x10)
787                          debug("(%i)", asi);                          debug("(%i)", asi);
788                  if (!(op2 & 4))                  if (!(op2 & 4))
789                          debug(",%%%s", sparc_regnames[rd]);                          debug(",%%%s", sparc_regnames[rd]);

Legend:
Removed from v.26  
changed lines
  Added in v.30

  ViewVC Help
Powered by ViewVC 1.1.26