<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><a href="#file1">lxdream.h</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+1</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">8884bf45f010 -> 799fdd4f704a</td></tr>
<tr class="alt" style=";" ><td><tt>sh4/<a href="#file2">mmux86.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">-14</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">8884bf45f010 -> 799fdd4f704a</td></tr>
<tr><td><tt>   /<a href="#file3">sh4trans.c</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+1</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">8884bf45f010 -> 799fdd4f704a</td></tr>
<tr class="alt" style=";" ><td><tt>   /<a href="#file4">sh4trans.h</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+5</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">8884bf45f010 -> 799fdd4f704a</td></tr>
<tr><td><tt>   /<a href="#file5">sh4x86.in</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+60</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-31</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">8884bf45f010 -> 799fdd4f704a</td></tr>
<tr class="alt" style=";" ><td><tt>xlat/x86/<a href="#file6">amd64abi.h</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+9</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">8884bf45f010 -> 799fdd4f704a</td></tr>
<tr><td><tt>        /<a href="#file7">ia32abi.h</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+22</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-6</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">8884bf45f010 -> 799fdd4f704a</td></tr>
<tr><td></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+112</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-57</td><td></td></tr>
</table>
<small id="info" style="color: #888888;" >7 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;" >
Move the generated prologue/epilogue code out into a common entry stub
(reduces space requirements) and pre-save all saved registers. Change
FASTCALL to use 3 regs instead of 2 since we can now keep everything in
regs.
</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</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>lxdream.h</b></big> <small id="info" style="color: #888888;" >8884bf45f010 -> 799fdd4f704a</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/lxdream.h
+++ lxdream/src/lxdream.h
@@ -111,7 +111,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 
 #ifdef HAVE_FASTCALL
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-#define FASTCALL __attribute__((regparm(<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >2</span>)))
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#define FASTCALL __attribute__((regparm(<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >3</span>)))
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #else
 #define FASTCALL
 #endif
</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>mmux86.c</b></big> <small id="info" style="color: #888888;" >8884bf45f010 -> 799fdd4f704a</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/sh4/mmux86.c
+++ lxdream/src/sh4/mmux86.c
@@ -70,10 +70,10 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             int rel = (*fn - xlat_output);
             JMP_prerel( rel ); // 5
         } else {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-            MOVL_r32_r32( REG_ARG1, REG_ECX ); // 2
-            SHRL_imm_r32( 12, REG_ECX );  // 3
-            XLAT(addr_space, REG_ECX);                   // 14
-            JMP_r32disp(REG_ECX, (((uintptr_t)out) - ((uintptr_t)&page->fn)) );    // 3
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+            MOVL_r32_r32( REG_ARG1, REG_CALLPTR ); // 2
+            SHRL_imm_r32( 12, REG_CALLPTR );  // 3
+            XLAT(addr_space, REG_CALLPTR);                   // 14
+            JMP_r32disp(REG_CALLPTR, (((uintptr_t)out) - ((uintptr_t)&page->fn)) );    // 3
</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;" >@@ -105,21 +105,21 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     
     for( i=0; i<9; i++, out++ ) {
         *out = xlat_output;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        MOVL_r32_r32( REG_ARG1, REG_ECX );
-        SHRL_imm_r32( 10, REG_ECX );
-        ANDL_imms_r32( 0x3, REG_ECX );
-        XLAT( (uintptr_t)&entry->subpages[0], REG_ECX );
-        JMP_r32disp(REG_ECX, (((uintptr_t)out) - ((uintptr_t)&entry->fn)) );    // 3
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        MOVL_r32_r32( REG_ARG1, REG_CALLPTR );
+        SHRL_imm_r32( 10, REG_CALLPTR );
+        ANDL_imms_r32( 0x3, REG_CALLPTR );
+        XLAT( (uintptr_t)&entry->subpages[0], REG_CALLPTR );
+        JMP_r32disp(REG_CALLPTR, (((uintptr_t)out) - ((uintptr_t)&entry->fn)) );    // 3
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
 
     out = (uint8_t **)&entry->user_fn;
     for( i=0; i<9; i++, out++ ) {
         *out = xlat_output;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        MOVL_r32_r32( REG_ARG1, REG_ECX );
-        SHRL_imm_r32( 10, REG_ECX );
-        ANDL_imms_r32( 0x3, REG_ECX );
-        XLAT( (uintptr_t)&entry->user_subpages[0], REG_ECX );
-        JMP_r32disp(REG_ECX, (((uintptr_t)out) - ((uintptr_t)&entry->user_fn)) );    // 3
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        MOVL_r32_r32( REG_ARG1, REG_CALLPTR );
+        SHRL_imm_r32( 10, REG_CALLPTR );
+        ANDL_imms_r32( 0x3, REG_CALLPTR );
+        XLAT( (uintptr_t)&entry->user_subpages[0], REG_CALLPTR );
+        JMP_r32disp(REG_CALLPTR, (((uintptr_t)out) - ((uintptr_t)&entry->user_fn)) );    // 3
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
 
 }
</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/sh4</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>sh4trans.c</b></big> <small id="info" style="color: #888888;" >8884bf45f010 -> 799fdd4f704a</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/sh4/sh4trans.c
+++ lxdream/src/sh4/sh4trans.c
@@ -63,7 +63,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         } else {
             code = sh4_translate_basic_block( sh4r.pc );
         }
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        code();
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        sh4_translate_enter(code);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
 }
 
</pre></div>
<hr /><a name="file4" /><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>sh4trans.h</b></big> <small id="info" style="color: #888888;" >8884bf45f010 -> 799fdd4f704a</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/sh4/sh4trans.h
+++ lxdream/src/sh4/sh4trans.h
@@ -67,6 +67,11 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > void sh4_translate_add_recovery( uint32_t icount );
 
 /**
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ * Enter the VM at the given translated entry point
+ */
+void FASTCALL (*sh4_translate_enter)(void *code);
+
+/**
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >  * Initialize shadow execution mode
  */
 void sh4_shadow_init( void );
</pre></div>
<hr /><a name="file5" /><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;" >8884bf45f010 -> 799fdd4f704a</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/sh4/sh4x86.in
+++ lxdream/src/sh4/sh4x86.in
@@ -115,6 +115,9 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 static struct sh4_x86_state sh4_x86;
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+static uint8_t sh4_entry_stub[128];
+void FASTCALL (*sh4_translate_enter)(void *code);
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > static uint32_t max_int = 0x7FFFFFFF;
 static uint32_t min_int = 0x80000000;
 static uint32_t save_fcw; /* save value for fpu control word */
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -143,16 +146,45 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     sh4_x86.user_address_space = user;
 }
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+void sh4_translate_write_entry_stub(void)
+{
+       mem_unprotect(sh4_entry_stub, sizeof(sh4_entry_stub));
+       xlat_output = sh4_entry_stub;
+       PUSH_r32(REG_EBP);
+       MOVP_immptr_rptr( ((uint8_t *)&sh4r) + 128, REG_EBP );
+       PUSH_r32(REG_EBX);
+       PUSH_r32(REG_SAVE1);
+       PUSH_r32(REG_SAVE2);
+#if SIZEOF_VOID_P == 8
+    PUSH_r32(REG_SAVE3);
+    PUSH_r32(REG_SAVE4);
+    CALL_r32( REG_ARG1 );
+    POP_r32(REG_SAVE4);
+    POP_r32(REG_SAVE3);
+#else
+    SUBL_imms_r32( 8, REG_ESP ); 
+       CALL_r32( REG_ARG1 );
+       ADDL_imms_r32( 8, REG_ESP );
+#endif
+       POP_r32(REG_SAVE2);     
+       POP_r32(REG_SAVE1);
+       POP_r32(REG_EBX);
+       POP_r32(REG_EBP);
+       RET();
+       sh4_translate_enter = sh4_entry_stub;
+}
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > void sh4_translate_init(void)
 {
     sh4_x86.backpatch_list = malloc(DEFAULT_BACKPATCH_SIZE);
     sh4_x86.backpatch_size = DEFAULT_BACKPATCH_SIZE / sizeof(struct backpatch_record);
     sh4_x86.begin_callback = NULL;
     sh4_x86.end_callback = NULL;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    sh4_translate_set_address_space( sh4_address_space, sh4_user_address_space );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     sh4_x86.fastmem = TRUE;
     sh4_x86.sse3_enabled = is_sse3_supported();
     xlat_set_target_fns(&x86_target_fns);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    sh4_translate_set_address_space( sh4_address_space, sh4_user_address_space );
+    sh4_translate_write_entry_stub();
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
 
 void sh4_translate_set_callbacks( xlat_block_begin_callback_t begin, xlat_block_end_callback_t end )
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -344,16 +376,16 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #ifdef HAVE_FRAME_ADDRESS
 static void call_read_func(int addr_reg, int value_reg, int offset, int pc)
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    decode_address(address_space(), addr_reg);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    decode_address(address_space(), addr_reg<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >, REG_CALLPTR</span>);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     if( !sh4_x86.tlb_on && (sh4_x86.sh4_mode & SR_MD) ) { 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        CALL1_r32disp_r32(REG_<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >ECX</span>, offset, addr_reg);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        CALL1_r32disp_r32(REG_<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >CALLPTR</span>, offset, addr_reg);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     } else {
         if( addr_reg != REG_ARG1 ) {
             MOVL_r32_r32( addr_reg, REG_ARG1 );
         }
         MOVP_immptr_rptr( 0, REG_ARG2 );
         sh4_x86_add_backpatch( xlat_output, pc, -2 );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        CALL2_r32disp_r32_r32(REG_<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >ECX</span>, offset, REG_ARG1, REG_ARG2);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        CALL2_r32disp_r32_r32(REG_<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >CALLPTR</span>, offset, REG_ARG1, REG_ARG2);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
     if( value_reg != REG_RESULT1 ) { 
         MOVL_r32_r32( REG_RESULT1, value_reg );
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -362,9 +394,9 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 static void call_write_func(int addr_reg, int value_reg, int offset, int pc)
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    decode_address(address_space(), addr_reg);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    decode_address(address_space(), addr_reg<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >, REG_CALLPTR</span>);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     if( !sh4_x86.tlb_on && (sh4_x86.sh4_mode & SR_MD) ) { 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        CALL2_r32disp_r32_r32(REG_<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >ECX</span>, offset, addr_reg, value_reg);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        CALL2_r32disp_r32_r32(REG_<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >CALLPTR</span>, offset, addr_reg, value_reg);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     } else {
         if( value_reg != REG_ARG2 ) {
             MOVL_r32_r32( value_reg, REG_ARG2 );
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -375,19 +407,19 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #if MAX_REG_ARG > 2        
         MOVP_immptr_rptr( 0, REG_ARG3 );
         sh4_x86_add_backpatch( xlat_output, pc, -2 );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        CALL3_r32disp_r32_r32_r32(REG_<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >ECX</span>, offset, REG_ARG1, REG_ARG2, REG_ARG3);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        CALL3_r32disp_r32_r32_r32(REG_<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >CALLPTR</span>, offset, REG_ARG1, REG_ARG2, REG_ARG3);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #else
         MOVL_imm32_rspdisp( 0, 0 );
         sh4_x86_add_backpatch( xlat_output, pc, -2 );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        CALL3_r32disp_r32_r32_r32(REG_<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >ECX</span>, offset, REG_ARG1, REG_ARG2, 0);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        CALL3_r32disp_r32_r32_r32(REG_<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >CALLPTR</span>, offset, REG_ARG1, REG_ARG2, 0);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #endif
     }
 }
 #else
 static void call_read_func(int addr_reg, int value_reg, int offset, int pc)
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    decode_address(address_space(), addr_reg);
-    CALL1_r32disp_r32(REG_ECX, offset, addr_reg);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    decode_address(address_space(), addr_reg, REG_CALLPTR);
+    CALL1_r32disp_r32(REG_CALLPTR, offset, addr_reg);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     if( value_reg != REG_RESULT1 ) {
         MOVL_r32_r32( REG_RESULT1, value_reg );
     }
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -395,8 +427,8 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 static void call_write_func(int addr_reg, int value_reg, int offset, int pc)
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    decode_address(address_space(), addr_reg);
-    CALL2_r32disp_r32_r32(REG_ECX, offset, addr_reg, value_reg);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    decode_address(address_space(), addr_reg, REG_CALLPTR);
+    CALL2_r32disp_r32_r32(REG_CALLPTR, offset, addr_reg, value_reg);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
 #endif
                 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -430,7 +462,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     sh4_x86.double_prec = sh4r.fpscr & FPSCR_PR;
     sh4_x86.double_size = sh4r.fpscr & FPSCR_SZ;
     sh4_x86.sh4_mode = sh4r.xlat_sh4_mode;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    emit_prologue();
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     if( sh4_x86.begin_callback ) {
         CALL_ptr( sh4_x86.begin_callback );
     }
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -486,7 +517,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >          CMPL_imms_r32disp( sh4_x86.sh4_mode, REG_EAX, XLAT_SH4_MODE_CODE_OFFSET );
        }
        JNE_label(wrongmode);
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-   LEAP_rptrdisp_rptr(REG_EAX, PROLOGUE_SIZE,REG_EAX);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >    if( sh4_x86.end_callback ) {
            /* Note this does leave the stack out of alignment, but doesn't matter
             * for what we're currently using it for.
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -518,7 +548,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
     uint8_t *backpatch = ((uint8_t *)__builtin_return_address(0)) - (CALL1_PTR_MIN_SIZE);
     *backpatch = 0xE9;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    *(uint32_t *)(backpatch+1) = (uint32_t)(target-backpatch)<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >+PROLOGUE_SIZE</span>-5;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    *(uint32_t *)(backpatch+1) = (uint32_t)(target-backpatch)-5;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     *(void **)(backpatch+5) = XLAT_BLOCK_FOR_CODE(target)->use_list;
     XLAT_BLOCK_FOR_CODE(target)->use_list = backpatch; 
 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -586,7 +616,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 static void exit_block()
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-   emit_epilogue();
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >    if( sh4_x86.end_callback ) {
            MOVP_immptr_rptr(sh4_x86.end_callback, REG_ECX);
            JMP_rptr(REG_ECX);
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -674,7 +703,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >           * looping.
             */
         CMPL_r32_rbpdisp( REG_ECX, REG_OFFSET(event_pending) );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        uint32_t backdisp = ((uintptr_t)(sh4_x86.code - xlat_output))<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" > + PROLOGUE_SIZE</span>;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        uint32_t backdisp = ((uintptr_t)(sh4_x86.code - xlat_output));
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         JCC_cc_prerel(X86_COND_A, backdisp);
        } else {
         MOVL_imm32_r32( pc - sh4_x86.block_start_pc, REG_ARG1 );
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -855,9 +884,9 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     COUNT_INST(I_ANDB);
     load_reg( REG_EAX, 0 );
     ADDL_rbpdisp_r32( R_GBR, REG_EAX );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    MOVL_r32_rspdisp(REG_EAX, 0);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    MOVL_r32_r32(REG_EAX, REG_SAVE1);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     MEM_READ_BYTE_FOR_WRITE( REG_EAX, REG_EDX );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    MOVL_rspdisp_r32(0, REG_EAX);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    MOVL_r32_r32(REG_SAVE1, REG_EAX);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     ANDL_imms_r32(imm, REG_EDX );
     MEM_WRITE_BYTE( REG_EAX, REG_EDX );
     sh4_x86.tstate = TSTATE_NONE;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -1044,7 +1073,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >      load_reg( REG_EAX, Rm );
        check_ralign32( REG_EAX );
        MEM_READ_LONG( REG_EAX, REG_EAX );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-   MOVL_r32_rspdisp(REG_EAX, 0);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+     MOVL_r32_r32(REG_EAX, REG_SAVE1);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >    load_reg( REG_EAX, Rm );
        LEAL_r32disp_r32( REG_EAX, 4, REG_EAX );
        MEM_READ_LONG( REG_EAX, REG_EAX );
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -1053,7 +1082,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >      load_reg( REG_EAX, Rm );
        check_ralign32( REG_EAX );
        MEM_READ_LONG( REG_EAX, REG_EAX );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-   MOVL_r32_rspdisp( REG_EAX, 0 );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+     MOVL_r32_r32(REG_EAX, REG_SAVE1);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >    load_reg( REG_EAX, Rn );
        check_ralign32( REG_EAX );
        MEM_READ_LONG( REG_EAX, REG_EAX );
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -1061,7 +1090,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >      ADDL_imms_rbpdisp( 4, REG_OFFSET(r[Rm]) );
     }
     
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    IMULL_rspdisp( 0 );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    IMULL_r32( REG_SAVE1 );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     ADDL_r32_rbpdisp( REG_EAX, R_MACL );
     ADCL_r32_rbpdisp( REG_EDX, R_MACH );
 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -1078,7 +1107,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >      load_reg( REG_EAX, Rm );
        check_ralign16( REG_EAX );
        MEM_READ_WORD( REG_EAX, REG_EAX );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        MOVL_r32_rspdisp( REG_EAX, 0 );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        MOVL_r32_r32( REG_EAX, REG_SAVE1 );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >    load_reg( REG_EAX, Rm );
        LEAL_r32disp_r32( REG_EAX, 2, REG_EAX );
        MEM_READ_WORD( REG_EAX, REG_EAX );
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -1089,14 +1118,14 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >      load_reg( REG_EAX, Rn );
        check_ralign16( REG_EAX );
        MEM_READ_WORD( REG_EAX, REG_EAX );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        MOVL_r32_rspdisp( REG_EAX, 0 );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        MOVL_r32_r32( REG_EAX, REG_SAVE1 );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >    load_reg( REG_EAX, Rm );
        check_ralign16( REG_EAX );
        MEM_READ_WORD( REG_EAX, REG_EAX );
        ADDL_imms_rbpdisp( 2, REG_OFFSET(r[Rn]) );
        ADDL_imms_rbpdisp( 2, REG_OFFSET(r[Rm]) );
     }
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    IMULL_rspdisp( 0 );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    IMULL_r32( REG_SAVE1 );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     MOVL_rbpdisp_r32( R_S, REG_ECX );
     TESTL_r32_r32( REG_ECX, REG_ECX );
     JE_label( nosat );
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -1195,9 +1224,9 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     COUNT_INST(I_ORB);
     load_reg( REG_EAX, 0 );
     ADDL_rbpdisp_r32( R_GBR, REG_EAX );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    MOVL_r32_rspdisp( REG_EAX, 0 );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    MOVL_r32_r32( REG_EAX, REG_SAVE1 );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     MEM_READ_BYTE_FOR_WRITE( REG_EAX, REG_EDX );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    MOVL_rspdisp_r32( 0, REG_EAX );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    MOVL_r32_r32( REG_SAVE1, REG_EAX );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     ORL_imms_r32(imm, REG_EDX );
     MEM_WRITE_BYTE( REG_EAX, REG_EDX );
     sh4_x86.tstate = TSTATE_NONE;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -1413,12 +1442,12 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > TAS.B @Rn {:  
     COUNT_INST(I_TASB);
     load_reg( REG_EAX, Rn );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    MOVL_r32_rspdisp( REG_EAX, 0 );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    MOVL_r32_r32( REG_EAX, REG_SAVE1 );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     MEM_READ_BYTE_FOR_WRITE( REG_EAX, REG_EDX );
     TESTB_r8_r8( REG_DL, REG_DL );
     SETE_t();
     ORB_imms_r8( 0x80, REG_DL );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    MOVL_rspdisp_r32( 0, REG_EAX );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    MOVL_r32_r32( REG_SAVE1, REG_EAX );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     MEM_WRITE_BYTE( REG_EAX, REG_EDX );
     sh4_x86.tstate = TSTATE_NONE;
 :}
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -1465,9 +1494,9 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     COUNT_INST(I_XORB);
     load_reg( REG_EAX, 0 );
     ADDL_rbpdisp_r32( R_GBR, REG_EAX ); 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    MOVL_r32_rspdisp( REG_EAX, 0 );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    MOVL_r32_r32( REG_EAX, REG_SAVE1 );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     MEM_READ_BYTE_FOR_WRITE(REG_EAX, REG_EDX);
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    MOVL_rspdisp_r32( 0, REG_EAX );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    MOVL_r32_r32( REG_SAVE1, REG_EAX );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     XORL_imms_r32( imm, REG_EDX );
     MEM_WRITE_BYTE( REG_EAX, REG_EDX );
     sh4_x86.tstate = TSTATE_NONE;
</pre></div>
<hr /><a name="file6" /><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>amd64abi.h</b></big> <small id="info" style="color: #888888;" >8884bf45f010 -> 799fdd4f704a</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/xlat/x86/amd64abi.h
+++ lxdream/src/xlat/x86/amd64abi.h
@@ -22,13 +22,18 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #define REG_ARG3 REG_RDX
 #define REG_RESULT1 REG_RAX
 #define MAX_REG_ARG 3  /* There's more, but we don't use more than 3 here anyway */
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#define REG_SAVE1 REG_R12
+#define REG_SAVE2 REG_R13
+#define REG_SAVE3 REG_R14
+#define REG_SAVE4 REG_R15
+#define REG_CALLPTR REG_EBX
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-static inline void decode_address( uintptr_t base, int addr_reg )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+static inline void decode_address( uintptr_t base, int addr_reg<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >, int target_reg</span> )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    MOVL_r32_r32( addr_reg, REG_ECX );
-    SHRL_imm_r32( 12, REG_ECX ); 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    MOVL_r32_r32( addr_reg, target_reg );
+    SHRL_imm_r32( 12, target_reg );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     MOVP_immptr_rptr( base, REG_RDI );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    MOVP_sib_rptr( 3, REG_RCX, REG_RDI, 0, REG_RCX );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    MOVP_sib_rptr( 3, target_reg, REG_RDI, 0, target_reg );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
 
 /**
</pre></div>
<hr /><a name="file7" /><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>ia32abi.h</b></big> <small id="info" style="color: #888888;" >8884bf45f010 -> 799fdd4f704a</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/xlat/x86/ia32abi.h
+++ lxdream/src/xlat/x86/ia32abi.h
@@ -23,14 +23,18 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 #define REG_ARG1 REG_EAX
 #define REG_ARG2 REG_EDX
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#define REG_ARG3 REG_ECX
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #define REG_RESULT1 REG_EAX
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-#define MAX_REG_ARG <span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >2</span>
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#define MAX_REG_ARG <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >3</span>
+#define REG_SAVE1 REG_ESI
+#define REG_SAVE2 REG_EDI
+#define REG_CALLPTR REG_EBX
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-static inline void decode_address( uintptr_t base, int addr_reg )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+static inline void decode_address( uintptr_t base, int addr_reg<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >, int target_reg</span> )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    MOVL_r32_r32( addr_reg, REG_ECX );
-    SHRL_imm_r32( 12, REG_ECX ); 
-    MOVP_sib_rptr( 2, REG_ECX, -1, base, REG_ECX );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    MOVL_r32_r32( addr_reg, target_reg );
+    SHRL_imm_r32( 12, target_reg );
+    MOVP_sib_rptr( 2, target_reg, -1, base, target_reg );
</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;" >@@ -84,7 +88,19 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     CALL_r32disp(preg, disp);
 }
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-#define CALL3_r32disp_r32_r32_r32(preg,disp,arg1,arg2,arg3) CALL2_r32disp_r32_r32(preg,disp,arg1,arg2)
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+static inline void CALL3_r32disp_r32_r32_r32( int preg, uint32_t disp, int arg1, int arg2, int arg3)
+{
+    if( arg3 != REG_ARG3 ) {
+        MOVL_r32_r32( arg3, REG_ARG3 );
+    }
+    if( arg2 != REG_ARG2 ) {
+        MOVL_r32_r32( arg2, REG_ARG2 );
+    }
+    if( arg1 != REG_ARG1 ) {
+        MOVL_r32_r32( arg1, REG_ARG1 );
+    }
+    CALL_r32disp(preg, disp);
+}
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 #else
 
</pre></div>
<center><small>Chaos Theory</small></center>
</div></body></html>