/[gxemul]/trunk/src/cpus/cpu_sh.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_sh.c

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

revision 14 by dpavlin, Mon Oct 8 16:18:51 2007 UTC revision 28 by dpavlin, Mon Oct 8 16:20:26 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2005-2006  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: cpu_sh.c,v 1.6 2005/09/04 14:38:17 debug Exp $   *  $Id: cpu_sh.c,v 1.17 2006/07/16 13:32:26 debug Exp $
29   *   *
30   *  Hitachi SuperH ("SH") CPU emulation.   *  Hitachi SuperH ("SH") CPU emulation.
31   *   *
# Line 71  int sh_cpu_new(struct cpu *cpu, struct m Line 71  int sh_cpu_new(struct cpu *cpu, struct m
71          cpu->cd.sh.compact = 1;          cpu->cd.sh.compact = 1;
72    
73          if (cpu->is_32bit) {          if (cpu->is_32bit) {
74                    cpu->run_instr = sh32_run_instr;
75                  cpu->update_translation_table = sh32_update_translation_table;                  cpu->update_translation_table = sh32_update_translation_table;
76                  cpu->invalidate_translation_caches_paddr =                  cpu->invalidate_translation_caches =
77                      sh32_invalidate_translation_caches_paddr;                      sh32_invalidate_translation_caches;
78                  cpu->invalidate_code_translation =                  cpu->invalidate_code_translation =
79                      sh32_invalidate_code_translation;                      sh32_invalidate_code_translation;
80          } else {          } else {
81                    cpu->run_instr = sh_run_instr;
82                  cpu->update_translation_table = sh_update_translation_table;                  cpu->update_translation_table = sh_update_translation_table;
83                  cpu->invalidate_translation_caches_paddr =                  cpu->invalidate_translation_caches =
84                      sh_invalidate_translation_caches_paddr;                      sh_invalidate_translation_caches;
85                  cpu->invalidate_code_translation =                  cpu->invalidate_code_translation =
86                      sh_invalidate_code_translation;                      sh_invalidate_code_translation;
87          }          }
# Line 126  void sh_cpu_dumpinfo(struct cpu *cpu) Line 128  void sh_cpu_dumpinfo(struct cpu *cpu)
128  void sh_cpu_register_dump(struct cpu *cpu, int gprs, int coprocs)  void sh_cpu_register_dump(struct cpu *cpu, int gprs, int coprocs)
129  {  {
130          char *symbol;          char *symbol;
131          uint64_t offset, tmp;          uint64_t offset;
132          int i, x = cpu->cpu_id, nregs = cpu->cd.sh.compact? 16 : 64;          int i, x = cpu->cpu_id, nregs = cpu->cd.sh.compact? 16 : 64;
133          int bits32 = cpu->cd.sh.bits == 32;          int bits32 = cpu->cd.sh.bits == 32;
134    
# Line 192  void sh_cpu_register_match(struct machin Line 194  void sh_cpu_register_match(struct machin
194    
195    
196  /*  /*
  *  sh_cpu_show_full_statistics():  
  *  
  *  Show detailed statistics on opcode usage on each cpu.  
  */  
 void sh_cpu_show_full_statistics(struct machine *m)  
 {  
         fatal("sh_cpu_show_full_statistics(): TODO\n");  
 }  
   
   
 /*  
197   *  sh_cpu_tlbdump():   *  sh_cpu_tlbdump():
198   *   *
199   *  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 213  void sh_cpu_show_full_statistics(struct Line 204  void sh_cpu_show_full_statistics(struct
204   */   */
205  void sh_cpu_tlbdump(struct machine *m, int x, int rawflag)  void sh_cpu_tlbdump(struct machine *m, int x, int rawflag)
206  {  {
207          fatal("sh_cpu_tlbdump(): TODO\n");  }
208    
209    
210    /*
211     *  sh_cpu_gdb_stub():
212     *
213     *  Execute a "remote GDB" command. Returns a newly allocated response string
214     *  on success, NULL on failure.
215     */
216    char *sh_cpu_gdb_stub(struct cpu *cpu, char *cmd)
217    {
218            fatal("sh_cpu_gdb_stub(): TODO\n");
219            return NULL;
220  }  }
221    
222    
# Line 245  int sh_cpu_interrupt_ack(struct cpu *cpu Line 248  int sh_cpu_interrupt_ack(struct cpu *cpu
248   *  lowest 4 or 8 bits then select sub-opcode.   *  lowest 4 or 8 bits then select sub-opcode.
249   */   */
250  int sh_cpu_disassemble_instr_compact(struct cpu *cpu, unsigned char *instr,  int sh_cpu_disassemble_instr_compact(struct cpu *cpu, unsigned char *instr,
251          int running, uint64_t dumpaddr, int bintrans)          int running, uint64_t dumpaddr)
252  {  {
253          uint64_t offset, addr;          uint64_t addr;
254          uint16_t iword;          uint16_t iword;
255          int hi4, lo4, lo8, r8, r4;          int hi4, lo4, lo8, r8, r4;
         char *symbol, *mnem = "ERROR";  
256    
257          if (cpu->byte_order == EMUL_BIG_ENDIAN)          if (cpu->byte_order == EMUL_BIG_ENDIAN)
258                  iword = (instr[0] << 8) + instr[1];                  iword = (instr[0] << 8) + instr[1];
# Line 569  int sh_cpu_disassemble_instr_compact(str Line 571  int sh_cpu_disassemble_instr_compact(str
571   *  cpu->pc for relative addresses.   *  cpu->pc for relative addresses.
572   */   */
573  int sh_cpu_disassemble_instr(struct cpu *cpu, unsigned char *instr,  int sh_cpu_disassemble_instr(struct cpu *cpu, unsigned char *instr,
574          int running, uint64_t dumpaddr, int bintrans)          int running, uint64_t dumpaddr)
575  {  {
576          uint64_t offset, addr;          uint64_t offset;
577          uint32_t iword;          uint32_t iword;
578          int hi6;          char *symbol;
         char *symbol, *mnem = "ERROR";  
579    
580          if (running)          if (running)
581                  dumpaddr = cpu->pc;                  dumpaddr = cpu->pc;
# Line 594  int sh_cpu_disassemble_instr(struct cpu Line 595  int sh_cpu_disassemble_instr(struct cpu
595    
596          if (cpu->cd.sh.compact)          if (cpu->cd.sh.compact)
597                  return sh_cpu_disassemble_instr_compact(cpu, instr,                  return sh_cpu_disassemble_instr_compact(cpu, instr,
598                      running, dumpaddr, bintrans);                      running, dumpaddr);
599    
600          if (cpu->byte_order == EMUL_BIG_ENDIAN)          if (cpu->byte_order == EMUL_BIG_ENDIAN)
601                  iword = (instr[0] << 24) + (instr[1] << 16) + (instr[2] << 8)                  iword = (instr[0] << 24) + (instr[1] << 16) + (instr[2] << 8)

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

  ViewVC Help
Powered by ViewVC 1.1.26