<html>
<body>
  <div id="body" style="background-color:#ffffff;" >
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head" style="border-bottom-width:1px;border-bottom-style:solid;" ><td class="headtd" style="padding:0;padding-top:.2em;" colspan="4">Commit in <b><tt>lxdream</tt></b></td></tr>
<tr><td><tt>src/sh4/<a href="#file1">mmu.c</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+8</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-8</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">a3984d242909 -> 71e28626b358</td></tr>
<tr class="alt" style=";" ><td><tt>test/sh4/<a href="#file2">testmmu.c</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+6</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-1</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">a3984d242909 -> 71e28626b358</td></tr>
<tr><td></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+14</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-9</td><td></td></tr>
</table>
<small id="info" style="color: #888888;" >2 modified files</small><br />
<div class="tasklist" style="padding:4px;border:1px dashed #000000;margin-top:1em;" ><ul>
<li><a href="#task1">FIXME: should this only be raised if TLB is enabled? */</a></li>
</ul></div>
<pre class="comment" style="white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;padding:4px;border:1px dashed #000000;background-color:#ffffdd;" >
Prevent writes to the mmu page tables when the TLB is disabled.
</pre>
<hr /><a name="file1" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/sh4</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>mmu.c</b></big> <small id="info" style="color: #888888;" >a3984d242909 -> 71e28626b358</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/sh4/mmu.c
+++ lxdream/src/sh4/mmu.c
@@ -208,7 +208,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > void MMU_ldtlb()
 {
     int urc = mmu_read_urc();
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    if( mmu_utlb[urc].flags & TLB_VALID )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    if( <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >IS_TLB_ENABLED() && </span>mmu_utlb[urc].flags & TLB_VALID )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         mmu_utlb_remove_entry( urc );
     mmu_utlb[urc].vpn = MMIO_READ(MMU, PTEH) & 0xFFFFFC00;
     mmu_utlb[urc].asid = MMIO_READ(MMU, PTEH) & 0x000000FF;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -216,7 +216,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     mmu_utlb[urc].flags = MMIO_READ(MMU, PTEL) & 0x00001FF;
     mmu_utlb[urc].pcmcia = MMIO_READ(MMU, PTEA);
     mmu_utlb[urc].mask = get_tlb_size_mask(mmu_utlb[urc].flags);
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    if( mmu_utlb[urc].flags & TLB_VALID )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    if( <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >IS_TLB_ENABLED() && </span>mmu_utlb[urc].flags & TLB_VALID )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         mmu_utlb_insert_entry( urc );
 }
 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -1312,7 +1312,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             ent->flags = ent->flags & ~(TLB_DIRTY|TLB_VALID);
             ent->flags |= (val & TLB_VALID);
             ent->flags |= ((val & 0x200)>>7);
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-            if( ((old_flags^ent->flags) & (TLB_VALID|TLB_DIRTY)) != 0 ) {
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+            if( <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >IS_TLB_ENABLED() && </span>((old_flags^ent->flags) & (TLB_VALID|TLB_DIRTY)) != 0 ) {
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >                 if( old_flags & TLB_VALID )
                     mmu_utlb_remove_entry( utlb );
                 if( ent->flags & TLB_VALID )
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -1327,20 +1327,20 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         }
 
         if( itlb == -2 || utlb == -2 ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-            RAISE_TLB_MULTIHIT_ERROR(addr);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" ><a name="task1" />+            RAISE_TLB_MULTIHIT_ERROR(addr); /* <span class="task" style="background-color:#ffff00;" >FIXME</span>: should this only be raised if TLB is enabled? */
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             EXCEPTION_EXIT();
             return;
         }
     } else {
         struct utlb_entry *ent = &mmu_utlb[UTLB_ENTRY(addr)];
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        if( ent->flags & TLB_VALID ) 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        if( IS_TLB_ENABLED() && ent->flags & TLB_VALID )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             mmu_utlb_remove_entry( UTLB_ENTRY(addr) );
         ent->vpn = (val & 0xFFFFFC00);
         ent->asid = (val & 0xFF);
         ent->flags = (ent->flags & ~(TLB_DIRTY|TLB_VALID));
         ent->flags |= (val & TLB_VALID);
         ent->flags |= ((val & 0x200)>>7);
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        if( ent->flags & TLB_VALID ) 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        if( IS_TLB_ENABLED() && ent->flags & TLB_VALID )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             mmu_utlb_insert_entry( UTLB_ENTRY(addr) );
     }
 }
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -1351,12 +1351,12 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     if( UTLB_DATA2(addr) ) {
         ent->pcmcia = val & 0x0000000F;
     } else {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        if( ent->flags & TLB_VALID ) 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        if( IS_TLB_ENABLED() && ent->flags & TLB_VALID )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             mmu_utlb_remove_entry( UTLB_ENTRY(addr) );
         ent->ppn = (val & 0x1FFFFC00);
         ent->flags = (val & 0x000001FF);
         ent->mask = get_tlb_size_mask(val);
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        if( ent->flags & TLB_VALID ) 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        if( IS_TLB_ENABLED() && ent->flags & TLB_VALID )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             mmu_utlb_insert_entry( UTLB_ENTRY(addr) );
     }
 }
</pre></div>
<hr /><a name="file2" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/test/sh4</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>testmmu.c</b></big> <small id="info" style="color: #888888;" >a3984d242909 -> 71e28626b358</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/test/sh4/testmmu.c
+++ lxdream/test/sh4/testmmu.c
@@ -68,9 +68,14 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
     /* Non-TLB behaviour tests */
     
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    install_utlb_test_handler();
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    /* TLB off tests (make sure the MMU _stays_ off) */
+    LOAD( 62, 0, 0x0C000000, 0x0CFFFC00, TLB_VALID|TLB_USERMODE|TLB_WRITABLE|TLB_SIZE_1K|TLB_CACHEABLE|TLB_DIRTY );
+    TEST( "TLB OFF", 0, 0x0C000018, 0x0C000018, OK, OK, OK, OK );
+    TEST( "TLB OFF", 1, 0x0C000018, 0x0C000018, OK, OK, OK, OK );
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     /* TLB tests */
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    install_utlb_test_handler();
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     invalidate_tlb();
     /* Permanently map the first and last MB of RAM into userspace - without 
      * this it's a bit hard to actually run any user-mode tests.
</pre></div>
<center><small>Chaos Theory</small></center>
</div></body></html>