Search
lxdream.org :: lxdream/src/sh4/mmu.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/mmu.c
changeset 1088:cf3900ae8acc
prev1067:d3c00ffccfcd
next1090:71e28626b358
author nkeynes
date Fri Dec 04 18:06:12 2009 +1000 (11 years ago)
permissions -rw-r--r--
last change Fix crash on vmu device create introduced in r1072 - config was being
initialised in the wrong order
file annotate diff log raw
1.1 --- a/src/sh4/mmu.c Sun Jul 05 13:54:48 2009 +1000
1.2 +++ b/src/sh4/mmu.c Fri Dec 04 18:06:12 2009 +1000
1.3 @@ -245,7 +245,6 @@
1.4 val &= 0xFFFFFCFF;
1.5 if( (val & 0xFF) != mmu_asid ) {
1.6 mmu_set_tlb_asid( val&0xFF );
1.7 - sh4_icache.page_vma = -1; // invalidate icache as asid has changed
1.8 }
1.9 break;
1.10 case PTEL:
1.11 @@ -473,47 +472,49 @@
1.12
1.13 static void mmu_set_tlb_asid( uint32_t asid )
1.14 {
1.15 - /* Scan for pages that need to be remapped */
1.16 - int i;
1.17 - if( IS_SV_ENABLED() ) {
1.18 - for( i=0; i<UTLB_ENTRY_COUNT; i++ ) {
1.19 - if( mmu_utlb[i].asid == mmu_asid &&
1.20 - (mmu_utlb[i].flags & (TLB_VALID|TLB_SHARE)) == (TLB_VALID) ) {
1.21 - // Matches old ASID - unmap out
1.22 - if( !mmu_utlb_unmap_pages( FALSE, TRUE, mmu_utlb[i].vpn&mmu_utlb[i].mask,
1.23 - get_tlb_size_pages(mmu_utlb[i].flags) ) )
1.24 - mmu_utlb_remap_pages( FALSE, TRUE, i );
1.25 + if( IS_TLB_ENABLED() ) {
1.26 + /* Scan for pages that need to be remapped */
1.27 + int i;
1.28 + if( IS_SV_ENABLED() ) {
1.29 + for( i=0; i<UTLB_ENTRY_COUNT; i++ ) {
1.30 + if( mmu_utlb[i].asid == mmu_asid &&
1.31 + (mmu_utlb[i].flags & (TLB_VALID|TLB_SHARE)) == (TLB_VALID) ) {
1.32 + // Matches old ASID - unmap out
1.33 + if( !mmu_utlb_unmap_pages( FALSE, TRUE, mmu_utlb[i].vpn&mmu_utlb[i].mask,
1.34 + get_tlb_size_pages(mmu_utlb[i].flags) ) )
1.35 + mmu_utlb_remap_pages( FALSE, TRUE, i );
1.36 + }
1.37 + }
1.38 + for( i=0; i<UTLB_ENTRY_COUNT; i++ ) {
1.39 + if( mmu_utlb[i].asid == asid &&
1.40 + (mmu_utlb[i].flags & (TLB_VALID|TLB_SHARE)) == (TLB_VALID) ) {
1.41 + // Matches new ASID - map in
1.42 + mmu_utlb_map_pages( NULL, mmu_utlb_pages[i].user_fn,
1.43 + mmu_utlb[i].vpn&mmu_utlb[i].mask,
1.44 + get_tlb_size_pages(mmu_utlb[i].flags) );
1.45 + }
1.46 + }
1.47 + } else {
1.48 + // Remap both Priv+user pages
1.49 + for( i=0; i<UTLB_ENTRY_COUNT; i++ ) {
1.50 + if( mmu_utlb[i].asid == mmu_asid &&
1.51 + (mmu_utlb[i].flags & (TLB_VALID|TLB_SHARE)) == (TLB_VALID) ) {
1.52 + if( !mmu_utlb_unmap_pages( TRUE, TRUE, mmu_utlb[i].vpn&mmu_utlb[i].mask,
1.53 + get_tlb_size_pages(mmu_utlb[i].flags) ) )
1.54 + mmu_utlb_remap_pages( TRUE, TRUE, i );
1.55 + }
1.56 + }
1.57 + for( i=0; i<UTLB_ENTRY_COUNT; i++ ) {
1.58 + if( mmu_utlb[i].asid == asid &&
1.59 + (mmu_utlb[i].flags & (TLB_VALID|TLB_SHARE)) == (TLB_VALID) ) {
1.60 + mmu_utlb_map_pages( &mmu_utlb_pages[i].fn, mmu_utlb_pages[i].user_fn,
1.61 + mmu_utlb[i].vpn&mmu_utlb[i].mask,
1.62 + get_tlb_size_pages(mmu_utlb[i].flags) );
1.63 + }
1.64 }
1.65 }
1.66 - for( i=0; i<UTLB_ENTRY_COUNT; i++ ) {
1.67 - if( mmu_utlb[i].asid == asid &&
1.68 - (mmu_utlb[i].flags & (TLB_VALID|TLB_SHARE)) == (TLB_VALID) ) {
1.69 - // Matches new ASID - map in
1.70 - mmu_utlb_map_pages( NULL, mmu_utlb_pages[i].user_fn,
1.71 - mmu_utlb[i].vpn&mmu_utlb[i].mask,
1.72 - get_tlb_size_pages(mmu_utlb[i].flags) );
1.73 - }
1.74 - }
1.75 - } else {
1.76 - // Remap both Priv+user pages
1.77 - for( i=0; i<UTLB_ENTRY_COUNT; i++ ) {
1.78 - if( mmu_utlb[i].asid == mmu_asid &&
1.79 - (mmu_utlb[i].flags & (TLB_VALID|TLB_SHARE)) == (TLB_VALID) ) {
1.80 - if( !mmu_utlb_unmap_pages( TRUE, TRUE, mmu_utlb[i].vpn&mmu_utlb[i].mask,
1.81 - get_tlb_size_pages(mmu_utlb[i].flags) ) )
1.82 - mmu_utlb_remap_pages( TRUE, TRUE, i );
1.83 - }
1.84 - }
1.85 - for( i=0; i<UTLB_ENTRY_COUNT; i++ ) {
1.86 - if( mmu_utlb[i].asid == asid &&
1.87 - (mmu_utlb[i].flags & (TLB_VALID|TLB_SHARE)) == (TLB_VALID) ) {
1.88 - mmu_utlb_map_pages( &mmu_utlb_pages[i].fn, mmu_utlb_pages[i].user_fn,
1.89 - mmu_utlb[i].vpn&mmu_utlb[i].mask,
1.90 - get_tlb_size_pages(mmu_utlb[i].flags) );
1.91 - }
1.92 - }
1.93 + sh4_icache.page_vma = -1; // invalidate icache as asid has changed
1.94 }
1.95 -
1.96 mmu_asid = asid;
1.97 }
1.98
.