/[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 31 by dpavlin, Mon Oct 8 16:20:40 2007 UTC revision 32 by dpavlin, Mon Oct 8 16:20:58 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: cpu_sparc.c,v 1.35 2006/07/23 12:40:24 debug Exp $   *  $Id: cpu_sparc.c,v 1.38 2006/09/19 10:50:08 debug Exp $
29   *   *
30   *  SPARC CPU emulation.   *  SPARC CPU emulation.
31   */   */
# Line 39  Line 39 
39  #include "machine.h"  #include "machine.h"
40  #include "memory.h"  #include "memory.h"
41  #include "misc.h"  #include "misc.h"
42    #include "settings.h"
43  #include "symbol.h"  #include "symbol.h"
44    
45    
# Line 90  int sparc_cpu_new(struct cpu *cpu, struc Line 91  int sparc_cpu_new(struct cpu *cpu, struc
91    
92          cpu->instruction_has_delayslot = sparc_cpu_instruction_has_delayslot;          cpu->instruction_has_delayslot = sparc_cpu_instruction_has_delayslot;
93    
94            /*  TODO: Separate this into 64-bit vs 32-bit?  */
95            cpu->translate_v2p = sparc_translate_v2p;
96    
97          if (cpu->is_32bit) {          if (cpu->is_32bit) {
98                  cpu->run_instr = sparc32_run_instr;                  cpu->run_instr = sparc32_run_instr;
99                  cpu->update_translation_table =                  cpu->update_translation_table =
# Line 147  int sparc_cpu_new(struct cpu *cpu, struc Line 151  int sparc_cpu_new(struct cpu *cpu, struc
151                  exit(1);                  exit(1);
152          }          }
153    
154            CPU_SETTINGS_ADD_REGISTER64("pc", cpu->pc);
155            CPU_SETTINGS_ADD_REGISTER64("y", cpu->cd.sparc.y);
156            CPU_SETTINGS_ADD_REGISTER64("pstate", cpu->cd.sparc.pstate);
157            for (i=0; i<N_SPARC_REG; i++)
158                    CPU_SETTINGS_ADD_REGISTER64(sparc_regnames[i],
159                        cpu->cd.sparc.r[i]);
160            /*  TODO: Handler for writes to the zero register!  */
161    
162          return 1;          return 1;
163  }  }
164    
# Line 279  void sparc_cpu_register_dump(struct cpu Line 291  void sparc_cpu_register_dump(struct cpu
291    
292    
293  /*  /*
  *  sparc_cpu_register_match():  
  */  
 void sparc_cpu_register_match(struct machine *m, char *name,  
         int writeflag, uint64_t *valuep, int *match_register)  
 {  
         int i, cpunr = 0;  
   
         /*  CPU number:  */  
         /*  TODO  */  
   
         for (i=0; i<N_SPARC_REG; i++) {  
                 if (strcasecmp(name, sparc_regnames[i]) == 0) {  
                         if (writeflag && i != SPARC_ZEROREG)  
                                 m->cpus[cpunr]->cd.sparc.r[i] = *valuep;  
                         else  
                                 *valuep = m->cpus[cpunr]->cd.sparc.r[i];  
                         *match_register = 1;  
                 }  
         }  
   
         if (strcasecmp(name, "pc") == 0) {  
                 if (writeflag) {  
                         m->cpus[cpunr]->pc = *valuep;  
                 } else {  
                         *valuep = m->cpus[cpunr]->pc;  
                 }  
                 *match_register = 1;  
         }  
   
         if (strcasecmp(name, "y") == 0) {  
                 if (writeflag) {  
                         m->cpus[cpunr]->cd.sparc.y = (uint32_t) *valuep;  
                 } else {  
                         *valuep = (uint32_t) m->cpus[cpunr]->cd.sparc.y;  
                 }  
                 *match_register = 1;  
         }  
   
         if (*match_register && m->cpus[cpunr]->is_32bit)  
                 (*valuep) &= 0xffffffffULL;  
 }  
   
   
 /*  
294   *  sparc_cpu_tlbdump():   *  sparc_cpu_tlbdump():
295   *   *
296   *  Called from the debugger to dump the TLB in a readable format.   *  Called from the debugger to dump the TLB in a readable format.
# Line 472  int sparc_cpu_instruction_has_delayslot( Line 440  int sparc_cpu_instruction_has_delayslot(
440                  switch (op2) {                  switch (op2) {
441                  case 56:/*  jump and link  */                  case 56:/*  jump and link  */
442                          return 1;                          return 1;
443                    case 57:/*  return  */
444                            return 1;
445                  }                  }
446                  break;                  break;
447          }          }

Legend:
Removed from v.31  
changed lines
  Added in v.32

  ViewVC Help
Powered by ViewVC 1.1.26