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

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

revision 39 by dpavlin, Mon Oct 8 16:21:17 2007 UTC revision 40 by dpavlin, Mon Oct 8 16:22:11 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: cpu_mips_coproc.c,v 1.62 2007/02/03 16:18:56 debug Exp $   *  $Id: cpu_mips_coproc.c,v 1.64 2007/04/28 09:19:51 debug Exp $
29   *   *
30   *  Emulation of MIPS coprocessors.   *  Emulation of MIPS coprocessors.
31   */   */
# Line 535  void mips_coproc_tlb_set_entry(struct cp Line 535  void mips_coproc_tlb_set_entry(struct cp
535   *   *
536   *  Note: In the R3000 case, the asid argument is shifted 6 bits.   *  Note: In the R3000 case, the asid argument is shifted 6 bits.
537   */   */
538  static void invalidate_asid(struct cpu *cpu, int asid)  static void invalidate_asid(struct cpu *cpu, unsigned int asid)
539  {  {
540          struct mips_coproc *cp = cpu->cd.mips.coproc[0];          struct mips_coproc *cp = cpu->cd.mips.coproc[0];
541          int i, ntlbs = cp->nr_of_tlbs;          unsigned int i, ntlbs = cp->nr_of_tlbs;
542          struct mips_tlb *tlb = cp->tlbs;          struct mips_tlb *tlb = cp->tlbs;
543    
544          if (cpu->cd.mips.cpu_type.mmu_model == MMU3K) {          if (cpu->cd.mips.cpu_type.mmu_model == MMU3K) {
# Line 683  void coproc_register_write(struct cpu *c Line 683  void coproc_register_write(struct cpu *c
683          int readonly = 0;          int readonly = 0;
684          uint64_t tmp = *ptr;          uint64_t tmp = *ptr;
685          uint64_t tmp2 = 0, old;          uint64_t tmp2 = 0, old;
686          int inval = 0, old_asid, oldmode;          int inval = 0;
687            unsigned int old_asid;
688            uint64_t oldmode;
689    
690          switch (cp->coproc_nr) {          switch (cp->coproc_nr) {
691          case 0:          case 0:
# Line 1800  void coproc_tlbwri(struct cpu *cpu, int Line 1802  void coproc_tlbwri(struct cpu *cpu, int
1802                  int pfn_shift = 12, vpn_shift = 12;                  int pfn_shift = 12, vpn_shift = 12;
1803                  int wf0, wf1, mask;                  int wf0, wf1, mask;
1804                  uint64_t vaddr0, vaddr1, paddr0, paddr1, ptmp;                  uint64_t vaddr0, vaddr1, paddr0, paddr1, ptmp;
1805                    uint64_t psize;
1806    
1807                  cp->tlbs[index].mask = cp->reg[COP0_PAGEMASK];                  cp->tlbs[index].mask = cp->reg[COP0_PAGEMASK];
1808                  cp->tlbs[index].hi   = cp->reg[COP0_ENTRYHI];                  cp->tlbs[index].hi   = cp->reg[COP0_ENTRYHI];
# Line 1838  void coproc_tlbwri(struct cpu *cpu, int Line 1841  void coproc_tlbwri(struct cpu *cpu, int
1841                  }                  }
1842    
1843                  paddr0 = ((cp->tlbs[index].lo0 & ENTRYLO_PFN_MASK)                  paddr0 = ((cp->tlbs[index].lo0 & ENTRYLO_PFN_MASK)
1844                      >> ENTRYLO_PFN_SHIFT) << pfn_shift;                      >> ENTRYLO_PFN_SHIFT) << pfn_shift
1845                        >> vpn_shift << vpn_shift;
1846                  paddr1 = ((cp->tlbs[index].lo1 & ENTRYLO_PFN_MASK)                  paddr1 = ((cp->tlbs[index].lo1 & ENTRYLO_PFN_MASK)
1847                      >> ENTRYLO_PFN_SHIFT) << pfn_shift;                      >> ENTRYLO_PFN_SHIFT) << pfn_shift
1848                        >> vpn_shift << vpn_shift;
1849    
1850                  if (cpu->cd.mips.cpu_type.mmu_model == MMU10K) {                  if (cpu->cd.mips.cpu_type.mmu_model == MMU10K) {
1851                          vaddr0 = cp->tlbs[index].hi &                          vaddr0 = cp->tlbs[index].hi &
# Line 1883  void coproc_tlbwri(struct cpu *cpu, int Line 1888  void coproc_tlbwri(struct cpu *cpu, int
1888                   *  Invalidate any code translations, if we are writing Dirty                   *  Invalidate any code translations, if we are writing Dirty
1889                   *  pages to the TLB:  (TODO: 4KB hardcoded... ugly)                   *  pages to the TLB:  (TODO: 4KB hardcoded... ugly)
1890                   */                   */
1891                  for (ptmp = 0; ptmp < (1 << pfn_shift); ptmp += 0x1000) {                  psize = 1 << pfn_shift;
1892                    for (ptmp = 0; ptmp < psize; ptmp += 0x1000) {
1893                          if (wf0)                          if (wf0)
1894                                  cpu->invalidate_code_translation(cpu,                                  cpu->invalidate_code_translation(cpu,
1895                                      paddr0 + ptmp, INVALIDATE_PADDR);                                      paddr0 + ptmp, INVALIDATE_PADDR);

Legend:
Removed from v.39  
changed lines
  Added in v.40

  ViewVC Help
Powered by ViewVC 1.1.26