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

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

revision 27 by dpavlin, Mon Oct 8 16:20:10 2007 UTC revision 28 by dpavlin, Mon Oct 8 16:20:26 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: memory_mips.c,v 1.8 2006/06/24 21:47:23 debug Exp $   *  $Id: memory_mips.c,v 1.9 2006/07/14 16:33:28 debug Exp $
29   *   *
30   *  MIPS-specific memory routines. Included from cpu_mips.c.   *  MIPS-specific memory routines. Included from cpu_mips.c.
31   *   *
# Line 54  int memory_cache_R3000(struct cpu *cpu, Line 54  int memory_cache_R3000(struct cpu *cpu,
54          uint32_t tag_mask;          uint32_t tag_mask;
55          unsigned char *memblock;          unsigned char *memblock;
56          struct memory *mem = cpu->mem;          struct memory *mem = cpu->mem;
         int offset;  
57  #endif  #endif
58          unsigned int i;          unsigned int i;
59          int cache_isolated = 0, addr, hit, which_cache = cache;          int cache_isolated = 0, addr, hit, which_cache = cache;
# Line 127  int memory_cache_R3000(struct cpu *cpu, Line 126  int memory_cache_R3000(struct cpu *cpu,
126                              old_cached_paddr);                              old_cached_paddr);
127  */  */
128                          memblock = memory_paddr_to_hostaddr(                          memblock = memory_paddr_to_hostaddr(
129                              mem, old_cached_paddr, MEM_WRITE);                              mem, old_cached_paddr & ~cpu->cd.mips.
130                          offset = old_cached_paddr                              cache_mask[which_cache], MEM_WRITE);
                             & ((1 << BITS_PER_MEMBLOCK) - 1)  
                             & ~cpu->cd.mips.cache_mask[which_cache];  
131    
132                          src = cpu->cd.mips.cache[which_cache];                          src = cpu->cd.mips.cache[which_cache];
133                          dst = memblock + (offset &                          dst = memblock;
                             ~cpu->cd.mips.cache_mask[which_cache]);  
134    
135                          src += cache_line *                          src += cache_line *
136                              cpu->cd.mips.cache_linesize[which_cache];                              cpu->cd.mips.cache_linesize[which_cache];
# Line 147  int memory_cache_R3000(struct cpu *cpu, Line 143  int memory_cache_R3000(struct cpu *cpu,
143                                  memcpy(dst, src,                                  memcpy(dst, src,
144                                      cpu->cd.mips.cache_linesize[which_cache]);                                      cpu->cd.mips.cache_linesize[which_cache]);
145                          }                          }
                         /*  offset is the offset within  
                          *  the memblock:  
                          *  printf("read: offset = 0x%x\n", offset);  
                          */  
146                  }                  }
147    
148                  /*  Copy from main memory into the cache:  */                  /*  Copy from main memory into the cache:  */
149                  memblock = memory_paddr_to_hostaddr(mem, paddr, writeflag);                  memblock = memory_paddr_to_hostaddr(mem, paddr
150                  offset = paddr & ((1 << BITS_PER_MEMBLOCK) - 1)                      & ~cpu->cd.mips.cache_mask[which_cache], writeflag);
                     & ~cpu->cd.mips.cache_mask[which_cache];  
                 /*  offset is offset within the memblock:  
                  *  printf("write: offset = 0x%x\n", offset);  
                  */  
151    
152  /*              fatal("  FETCHING new paddr=0%08x\n", paddr);  /*              fatal("  FETCHING new paddr=0%08x\n", paddr);
153  */  */
# Line 170  int memory_cache_R3000(struct cpu *cpu, Line 158  int memory_cache_R3000(struct cpu *cpu,
158                          memset(dst, 0,                          memset(dst, 0,
159                              cpu->cd.mips.cache_linesize[which_cache]);                              cpu->cd.mips.cache_linesize[which_cache]);
160                  } else {                  } else {
161                          src = memblock + (offset &                          src = memblock;
                             ~cpu->cd.mips.cache_mask[which_cache]);  
162    
163                          src += cache_line *                          src += cache_line *
164                              cpu->cd.mips.cache_linesize[which_cache];                              cpu->cd.mips.cache_linesize[which_cache];

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

  ViewVC Help
Powered by ViewVC 1.1.26