/[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 38 by dpavlin, Mon Oct 8 16:21:53 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: memory_sh.c,v 1.18 2007/04/13 07:06:31 debug Exp $   *  $Id: memory_sh.c,v 1.23 2007/06/05 06:41:30 debug Exp $
29   */   */
30    
31  #include <stdio.h>  #include <stdio.h>
# Line 153  static int translate_via_mmu(struct cpu Line 153  static int translate_via_mmu(struct cpu
153          if (flags & FLAG_INSTR) {          if (flags & FLAG_INSTR) {
154                  /*                  /*
155                   *  Instruction access:                   *  Instruction access:
156                   *                   */
157    #if 0
158                    /*  NOTE: Emulating the ITLB as exact as this is not
159                            necessary... so I'm disabling it for now.  */
160                    /*
161                   *  If a matching entry wasn't found in the ITLB, but in the                   *  If a matching entry wasn't found in the ITLB, but in the
162                   *  UTLB, then copy it to a random place in the ITLB.                   *  UTLB, then copy it to a random place in the ITLB.
163                   */                   */
164                  if (i >= 0) {                  if (i >= 0 && !(flags & FLAG_NOEXCEPTIONS)) {
165                          int r = random() % SH_N_ITLB_ENTRIES;                          int r = random() % SH_N_ITLB_ENTRIES;
166    
167                          /*  NOTE: Make sure that the old mapping for                          /*  NOTE: Make sure that the old mapping for
# Line 171  static int translate_via_mmu(struct cpu Line 175  static int translate_via_mmu(struct cpu
175                          cpu->cd.sh.itlb_hi[r] = cpu->cd.sh.utlb_hi[i];                          cpu->cd.sh.itlb_hi[r] = cpu->cd.sh.utlb_hi[i];
176                          cpu->cd.sh.itlb_lo[r] = cpu->cd.sh.utlb_lo[i];                          cpu->cd.sh.itlb_lo[r] = cpu->cd.sh.utlb_lo[i];
177                  }                  }
178    #endif
179    
180                  /*  Permission checks:  */                  /*  Permission checks:  */
181                  if (cpu->cd.sh.sr & SH_SR_MD)                  if (cpu->cd.sh.sr & SH_SR_MD)
# Line 243  exception: Line 248  exception:
248   *              available as read-only.   *              available as read-only.
249   *      2       Same as 1, but the page is available as read/write.   *      2       Same as 1, but the page is available as read/write.
250   */   */
251  int sh_translate_v2p(struct cpu *cpu, uint64_t vaddr, uint64_t *return_paddr,  int sh_translate_v2p(struct cpu *cpu, uint64_t vaddr64, uint64_t *return_paddr,
252          int flags)          int flags)
253  {  {
254          int user = cpu->cd.sh.sr & SH_SR_MD? 0 : 1;          int user = cpu->cd.sh.sr & SH_SR_MD? 0 : 1;
255            uint32_t vaddr = vaddr64;
         vaddr = (uint32_t)vaddr;  
256    
257          /*  U0/P0: Userspace addresses, or P3: Kernel virtual memory.  */          /*  U0/P0: Userspace addresses, or P3: Kernel virtual memory.  */
258          if (!(vaddr & 0x80000000) ||          if (!(vaddr & 0x80000000) ||
# Line 306  int sh_translate_v2p(struct cpu *cpu, ui Line 310  int sh_translate_v2p(struct cpu *cpu, ui
310          }          }
311    
312          /*  TODO  */          /*  TODO  */
313          fatal("Unimplemented SH vaddr 0x%08"PRIx32"\n", (uint32_t)vaddr);  
314          exit(1);          /*  The ugly 'if' is just here to fool Compaq CC.  */
315            if (!(flags & FLAG_NOEXCEPTIONS)) {
316                    fatal("Unimplemented SH vaddr 0x%08"PRIx32"\n", vaddr);
317                    exit(1);
318            }
319    
320          return 0;          return 0;
321  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26