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

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

revision 34 by dpavlin, Mon Oct 8 16:21:17 2007 UTC revision 38 by dpavlin, Mon Oct 8 16:21:53 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: memory_sh.c,v 1.15 2007/01/29 18:06:37 debug Exp $   *  $Id: memory_sh.c,v 1.18 2007/04/13 07:06:31 debug Exp $
29   */   */
30    
31  #include <stdio.h>  #include <stdio.h>
# Line 85  static int translate_via_mmu(struct cpu Line 85  static int translate_via_mmu(struct cpu
85    
86                  /*  fatal("urc = %i  ==>  ", urc);  */                  /*  fatal("urc = %i  ==>  ", urc);  */
87                  urc ++;                  urc ++;
88                  if (urc == SH_N_UTLB_ENTRIES || (urb > 0 && urc == urb))                  if (urc >= SH_N_UTLB_ENTRIES || (urb > 0 && urc == urb))
89                          urc = 0;                          urc = 0;
90                  /*  fatal("%i\n", urc);  */                  /*  fatal("%i\n", urc);  */
91    
# Line 113  static int translate_via_mmu(struct cpu Line 113  static int translate_via_mmu(struct cpu
113                  mask = 0xfff00000;                  mask = 0xfff00000;
114    
115                  v = lo & SH4_PTEL_V;                  v = lo & SH4_PTEL_V;
116                    if (!v)
117                            continue;
118    
119                  switch (lo & SH4_PTEL_SZ_MASK) {                  switch (lo & SH4_PTEL_SZ_MASK) {
120                  case SH4_PTEL_SZ_1K:  mask = 0xfffffc00; break;                  case SH4_PTEL_SZ_1K:  mask = 0xfffffc00; break;
# Line 121  static int translate_via_mmu(struct cpu Line 123  static int translate_via_mmu(struct cpu
123                  /*  case SH4_PTEL_SZ_1M:  mask = 0xfff00000; break;  */                  /*  case SH4_PTEL_SZ_1M:  mask = 0xfff00000; break;  */
124                  }                  }
125    
126                  if (!v || (hi & mask) != (vaddr & mask))                  if ((hi & mask) != (vaddr & mask))
127                          continue;                          continue;
128    
129                  sh = lo & SH4_PTEL_SH;                  sh = lo & SH4_PTEL_SH;
# Line 141  static int translate_via_mmu(struct cpu Line 143  static int translate_via_mmu(struct cpu
143          if (i == SH_N_UTLB_ENTRIES)          if (i == SH_N_UTLB_ENTRIES)
144                  goto tlb_miss;                  goto tlb_miss;
145    
146          /*  Matching address found! Let's see it is readable/writable, etc:  */          /*  Matching address found! Let's see whether it is
147          d = lo & SH4_PTEL_D;              readable/writable, etc.:  */
148            d = lo & SH4_PTEL_D? 1 : 0;
149          pr = (lo & SH4_PTEL_PR_MASK) >> SH4_PTEL_PR_SHIFT;          pr = (lo & SH4_PTEL_PR_MASK) >> SH4_PTEL_PR_SHIFT;
150    
151          *return_paddr = (vaddr & ~mask) | (lo & mask & 0x1fffffff);          *return_paddr = (vaddr & ~mask) | (lo & mask & 0x1fffffff);
# Line 189  static int translate_via_mmu(struct cpu Line 192  static int translate_via_mmu(struct cpu
192                  case 1:                  case 1:
193                  case 3: if (wf && !d)                  case 3: if (wf && !d)
194                                  goto initial_write_exception;                                  goto initial_write_exception;
195                          return 1;                          return 1 + d;
196                  }                  }
197          }          }
198    
# Line 202  static int translate_via_mmu(struct cpu Line 205  static int translate_via_mmu(struct cpu
205                  return 1;                  return 1;
206          case 3: if (wf && !d)          case 3: if (wf && !d)
207                          goto initial_write_exception;                          goto initial_write_exception;
208                  return 1;                  return 1 + d;
209          }          }
210    
211    
# Line 305  int sh_translate_v2p(struct cpu *cpu, ui Line 308  int sh_translate_v2p(struct cpu *cpu, ui
308          /*  TODO  */          /*  TODO  */
309          fatal("Unimplemented SH vaddr 0x%08"PRIx32"\n", (uint32_t)vaddr);          fatal("Unimplemented SH vaddr 0x%08"PRIx32"\n", (uint32_t)vaddr);
310          exit(1);          exit(1);
311    
312            return 0;
313  }  }
314    

Legend:
Removed from v.34  
changed lines
  Added in v.38

  ViewVC Help
Powered by ViewVC 1.1.26