Search
lxdream.org :: lxdream :: r1088:cf3900ae8acc
lxdream 0.9.1
released Jun 29
Download Now
changeset1088:cf3900ae8acc
parent1087:d54c499b48c7
child1089:a3984d242909
authornkeynes
dateFri Dec 04 18:06:12 2009 +1000 (11 years ago)
Fix crash on vmu device create introduced in r1072 - config was being
initialised in the wrong order
src/maple/vmu.c
src/sh4/mmu.c
1.1 --- a/src/maple/vmu.c Fri Dec 04 08:44:22 2009 +1000
1.2 +++ b/src/maple/vmu.c Fri Dec 04 18:06:12 2009 +1000
1.3 @@ -101,8 +101,8 @@
1.4 static maple_device_t vmu_new( )
1.5 {
1.6 vmu_device_t dev = malloc( sizeof(struct vmu_device) );
1.7 + memcpy( dev, &base_vmu, sizeof(base_vmu) );
1.8 dev->config.data = dev;
1.9 - memcpy( dev, &base_vmu, sizeof(base_vmu) );
1.10 return MAPLE_DEVICE(dev);
1.11 }
1.12
2.1 --- a/src/sh4/mmu.c Fri Dec 04 08:44:22 2009 +1000
2.2 +++ b/src/sh4/mmu.c Fri Dec 04 18:06:12 2009 +1000
2.3 @@ -245,7 +245,6 @@
2.4 val &= 0xFFFFFCFF;
2.5 if( (val & 0xFF) != mmu_asid ) {
2.6 mmu_set_tlb_asid( val&0xFF );
2.7 - sh4_icache.page_vma = -1; // invalidate icache as asid has changed
2.8 }
2.9 break;
2.10 case PTEL:
2.11 @@ -473,47 +472,49 @@
2.12
2.13 static void mmu_set_tlb_asid( uint32_t asid )
2.14 {
2.15 - /* Scan for pages that need to be remapped */
2.16 - int i;
2.17 - if( IS_SV_ENABLED() ) {
2.18 - for( i=0; i<UTLB_ENTRY_COUNT; i++ ) {
2.19 - if( mmu_utlb[i].asid == mmu_asid &&
2.20 - (mmu_utlb[i].flags & (TLB_VALID|TLB_SHARE)) == (TLB_VALID) ) {
2.21 - // Matches old ASID - unmap out
2.22 - if( !mmu_utlb_unmap_pages( FALSE, TRUE, mmu_utlb[i].vpn&mmu_utlb[i].mask,
2.23 - get_tlb_size_pages(mmu_utlb[i].flags) ) )
2.24 - mmu_utlb_remap_pages( FALSE, TRUE, i );
2.25 + if( IS_TLB_ENABLED() ) {
2.26 + /* Scan for pages that need to be remapped */
2.27 + int i;
2.28 + if( IS_SV_ENABLED() ) {
2.29 + for( i=0; i<UTLB_ENTRY_COUNT; i++ ) {
2.30 + if( mmu_utlb[i].asid == mmu_asid &&
2.31 + (mmu_utlb[i].flags & (TLB_VALID|TLB_SHARE)) == (TLB_VALID) ) {
2.32 + // Matches old ASID - unmap out
2.33 + if( !mmu_utlb_unmap_pages( FALSE, TRUE, mmu_utlb[i].vpn&mmu_utlb[i].mask,
2.34 + get_tlb_size_pages(mmu_utlb[i].flags) ) )
2.35 + mmu_utlb_remap_pages( FALSE, TRUE, i );
2.36 + }
2.37 + }
2.38 + for( i=0; i<UTLB_ENTRY_COUNT; i++ ) {
2.39 + if( mmu_utlb[i].asid == asid &&
2.40 + (mmu_utlb[i].flags & (TLB_VALID|TLB_SHARE)) == (TLB_VALID) ) {
2.41 + // Matches new ASID - map in
2.42 + mmu_utlb_map_pages( NULL, mmu_utlb_pages[i].user_fn,
2.43 + mmu_utlb[i].vpn&mmu_utlb[i].mask,
2.44 + get_tlb_size_pages(mmu_utlb[i].flags) );
2.45 + }
2.46 + }
2.47 + } else {
2.48 + // Remap both Priv+user pages
2.49 + for( i=0; i<UTLB_ENTRY_COUNT; i++ ) {
2.50 + if( mmu_utlb[i].asid == mmu_asid &&
2.51 + (mmu_utlb[i].flags & (TLB_VALID|TLB_SHARE)) == (TLB_VALID) ) {
2.52 + if( !mmu_utlb_unmap_pages( TRUE, TRUE, mmu_utlb[i].vpn&mmu_utlb[i].mask,
2.53 + get_tlb_size_pages(mmu_utlb[i].flags) ) )
2.54 + mmu_utlb_remap_pages( TRUE, TRUE, i );
2.55 + }
2.56 + }
2.57 + for( i=0; i<UTLB_ENTRY_COUNT; i++ ) {
2.58 + if( mmu_utlb[i].asid == asid &&
2.59 + (mmu_utlb[i].flags & (TLB_VALID|TLB_SHARE)) == (TLB_VALID) ) {
2.60 + mmu_utlb_map_pages( &mmu_utlb_pages[i].fn, mmu_utlb_pages[i].user_fn,
2.61 + mmu_utlb[i].vpn&mmu_utlb[i].mask,
2.62 + get_tlb_size_pages(mmu_utlb[i].flags) );
2.63 + }
2.64 }
2.65 }
2.66 - for( i=0; i<UTLB_ENTRY_COUNT; i++ ) {
2.67 - if( mmu_utlb[i].asid == asid &&
2.68 - (mmu_utlb[i].flags & (TLB_VALID|TLB_SHARE)) == (TLB_VALID) ) {
2.69 - // Matches new ASID - map in
2.70 - mmu_utlb_map_pages( NULL, mmu_utlb_pages[i].user_fn,
2.71 - mmu_utlb[i].vpn&mmu_utlb[i].mask,
2.72 - get_tlb_size_pages(mmu_utlb[i].flags) );
2.73 - }
2.74 - }
2.75 - } else {
2.76 - // Remap both Priv+user pages
2.77 - for( i=0; i<UTLB_ENTRY_COUNT; i++ ) {
2.78 - if( mmu_utlb[i].asid == mmu_asid &&
2.79 - (mmu_utlb[i].flags & (TLB_VALID|TLB_SHARE)) == (TLB_VALID) ) {
2.80 - if( !mmu_utlb_unmap_pages( TRUE, TRUE, mmu_utlb[i].vpn&mmu_utlb[i].mask,
2.81 - get_tlb_size_pages(mmu_utlb[i].flags) ) )
2.82 - mmu_utlb_remap_pages( TRUE, TRUE, i );
2.83 - }
2.84 - }
2.85 - for( i=0; i<UTLB_ENTRY_COUNT; i++ ) {
2.86 - if( mmu_utlb[i].asid == asid &&
2.87 - (mmu_utlb[i].flags & (TLB_VALID|TLB_SHARE)) == (TLB_VALID) ) {
2.88 - mmu_utlb_map_pages( &mmu_utlb_pages[i].fn, mmu_utlb_pages[i].user_fn,
2.89 - mmu_utlb[i].vpn&mmu_utlb[i].mask,
2.90 - get_tlb_size_pages(mmu_utlb[i].flags) );
2.91 - }
2.92 - }
2.93 + sh4_icache.page_vma = -1; // invalidate icache as asid has changed
2.94 }
2.95 -
2.96 mmu_asid = asid;
2.97 }
2.98
.