<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/src</tt></b></td></tr>
<tr><td><tt>sh4/<a href="#file1">sh4x86.in</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+9</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-7</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">2e66e9053037 -> 12fdf3aafcd4</td></tr>
<tr class="alt" style=";" ><td><tt>   /<a href="#file2">shadow.c</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+14</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-4</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">2e66e9053037 -> 12fdf3aafcd4</td></tr>
<tr><td><tt>xlat/x86/<a href="#file3">x86op.h</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+2</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">2e66e9053037 -> 12fdf3aafcd4</td></tr>
<tr><td></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+25</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-11</td><td></td></tr>
</table>
<small id="info" style="color: #888888;" >3 modified files</small><br />
<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;" >
SH4 shadow-mode tweaks
  - Fix exceptions generated by the translator to account for the excepting
    instruction(s) in the cycle counts.
  - Compare floating point regs bitwise rather than with FP comparisons
    (otherwise can fail due to nan != nan)
  - Dump the translated block when we abort with an inconsistency
</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>sh4x86.in</b></big> <small id="info" style="color: #888888;" >2e66e9053037 -> 12fdf3aafcd4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/sh4/sh4x86.in
+++ lxdream/src/sh4/sh4x86.in
@@ -130,6 +130,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     { "sh4_write_fpscr", sh4_write_fpscr },
     { "sh4_write_sr", sh4_write_sr },
     { "sh4_read_sr", sh4_read_sr },
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    { "sh4_raise_exception", sh4_raise_exception },
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     { "sh4_sleep", sh4_sleep },
     { "sh4_fsca", sh4_fsca },
     { "sh4_ftrv", sh4_ftrv },
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -365,9 +366,9 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #define check_priv( ) \
     if( (sh4_x86.sh4_mode & SR_MD) == 0 ) { \
         if( sh4_x86.in_delay_slot ) { \
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-            exit_block_exc(EXC_SLOT_ILLEGAL, (pc-2) ); \
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+            exit_block_exc(EXC_SLOT_ILLEGAL, (pc-2)<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >, 4</span> ); \
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         } else { \
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-            exit_block_exc(EXC_ILLEGAL, pc); \
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+            exit_block_exc(EXC_ILLEGAL, pc<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >, 2</span>); \
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         } \
         sh4_x86.branch_taken = TRUE; \
         sh4_x86.in_delay_slot = DELAY_NONE; \
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -486,7 +487,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #define MEM_WRITE_LONG( addr_reg, value_reg ) call_write_func(addr_reg, value_reg, MEM_REGION_PTR(write_long), pc)
 #define MEM_PREFETCH( addr_reg ) call_read_func(addr_reg, REG_RESULT1, MEM_REGION_PTR(prefetch), pc)
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-#define SLOTILLEGAL() exit_block_exc(EXC_SLOT_ILLEGAL, pc-2); sh4_x86.in_delay_slot = DELAY_NONE; return 2;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#define SLOTILLEGAL() exit_block_exc(EXC_SLOT_ILLEGAL, pc-2<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >, 4</span>); sh4_x86.in_delay_slot = DELAY_NONE; return 2;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 /** Offset of xlat_sh4_mode field relative to the code pointer */ 
 #define XLAT_SH4_MODE_CODE_OFFSET  (int32_t)(offsetof(struct xlat_cache_block, xlat_sh4_mode) - offsetof(struct xlat_cache_block,code) )
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -763,11 +764,11 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > /**
  * Exit unconditionally with a general exception
  */
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-void exit_block_exc( int code, sh4addr_t pc )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+void exit_block_exc( int code, sh4addr_t pc<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >, int inst_adjust</span> )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
     MOVL_imm32_r32( pc - sh4_x86.block_start_pc, REG_ECX );
     ADDL_r32_rbpdisp( REG_ECX, R_PC );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    MOVL_imm32_r32( ((pc - sh4_x86.block_start_pc)>>1)*sh4_cpu_period, REG_ECX );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    MOVL_imm32_r32( ((pc - sh4_x86.block_start_pc<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" > + inst_adjust</span>)>>1)*sh4_cpu_period, REG_ECX );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     ADDL_r32_rbpdisp( REG_ECX, REG_OFFSET(slice_cycle) );
     MOVL_imm32_r32( code, REG_ARG1 );
     CALL1_ptr_r32( sh4_raise_exception, REG_ARG1 );
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -816,6 +817,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         ADDL_r32_r32( REG_EDX, REG_ECX );
         ADDL_r32_rbpdisp( REG_ECX, R_SPC );
         MOVL_moffptr_eax( &sh4_cpu_period );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        INC_r32( REG_EDX );  /* Add 1 for the aborting instruction itself */ 
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         MULL_r32( REG_EDX );
         ADDL_r32_rbpdisp( REG_EAX, REG_OFFSET(slice_cycle) );
         exit_block();
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -2208,9 +2210,9 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > UNDEF {:  
     COUNT_INST(I_UNDEF);
     if( sh4_x86.in_delay_slot ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-   exit_block_exc(EXC_SLOT_ILLEGAL, pc-2);    
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+     exit_block_exc(EXC_SLOT_ILLEGAL, pc-2<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >, 4</span>);    
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     } else {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-   exit_block_exc(EXC_ILLEGAL, pc);    
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+     exit_block_exc(EXC_ILLEGAL, pc<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >, 2</span>);    
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >    return 2;
     }
 :}
</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/src/sh4</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>shadow.c</b></big> <small id="info" style="color: #888888;" >2e66e9053037 -> 12fdf3aafcd4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/sh4/shadow.c
+++ lxdream/src/sh4/shadow.c
@@ -129,15 +129,23 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         }
     }
     for( unsigned i=0; i<16; i++ ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        if( xsh4r->fr[0][i] != esh4r->fr[0][i] ) {
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        if( *((uint32_t *)&xsh4r->fr[0][i]) != *((uint32_t *)&esh4r->fr[0][i]) ) {
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             isgood = FALSE;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-            fprintf( stderr, "FR%d  Xlt = %f, Emu = %f\n", i, xsh4r->fr[0][i], esh4r->fr[0][i] );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+            fprintf( stderr, "FR%d  Xlt = %f (0x%08X), Emu = %f (0x%08X)\n", i, xsh4r->fr[0][i],
+                    *((uint32_t *)&xsh4r->fr[0][i]),
+                    esh4r->fr[0][i],
+                    *((uint32_t *)&esh4r->fr[0][i])
+                    );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         }
     }
     for( unsigned i=0; i<16; i++ ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        if( xsh4r->fr[1][i] != esh4r->fr[1][i] ) {
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        if( *((uint32_t *)&xsh4r->fr[1][i]) != *((uint32_t *)&esh4r->fr[1][i]) ) {
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             isgood = FALSE;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-            fprintf( stderr, "XF%d  Xlt = %f, Emu = %f\n", i, xsh4r->fr[1][i], esh4r->fr[1][i] );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+            fprintf( stderr, "XF%d  Xlt = %f (0x%08X), Emu = %f (0x%08X)\n", i, xsh4r->fr[1][i],
+                    *((uint32_t *)&xsh4r->fr[1][i]),
+                    esh4r->fr[1][i],
+                    *((uint32_t *)&esh4r->fr[1][i])
+                    );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         }
     }
 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -306,6 +314,8 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
     if( !check_registers( &temp_sh4r, &sh4r ) ) {
         fprintf( stderr, "After executing block at %08X\n", shadow_sh4r.pc );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        fprintf( stderr, "Translated block was:\n" );
+        sh4_translate_dump_block(shadow_sh4r.pc);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         abort();
     }
     if( mem_check_posn < mem_log_posn ) {
</pre></div>
<hr /><a name="file3" /><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/xlat/x86</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>x86op.h</b></big> <small id="info" style="color: #888888;" >2e66e9053037 -> 12fdf3aafcd4</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/xlat/x86/x86op.h
+++ lxdream/src/xlat/x86/x86op.h
@@ -422,6 +422,8 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #define IMULQ_imms_r64(imm,r1)       x86_encode_imms_rm64(0x6B,0x69, r1, imm, r1)
 #define IMULQ_r64_r64(r1,r2)         x86_encode_r64_rm64(0x0FAF, r2, r1)
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#define INC_r32(r1)                  x86_encode_r32_rm32(0xFF, 0, r1)
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #define LEAL_r32disp_r32(r1,disp,r2) x86_encode_r32_mem32(0x8D, r2, r1, -1, 0, disp)
 #define LEAL_rbpdisp_r32(disp,r1)    x86_encode_r32_rbpdisp32(0x8D, r1, disp)
 #define LEAL_sib_r32(ss,ii,bb,d,r1)  x86_encode_r32_mem32(0x8D, r1, bb, ii, ss, d)
</pre></div>
<center><small>Chaos Theory</small></center>
</div></body></html>