about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-05-19 19:22:01 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-05-19 19:22:01 +0200
commited3450388bb10f917d8b1fd2efb5c2a302bffeac (patch)
tree9883fb2168a283def9202c54eb4243fc75e0ec96 /src
parenta2d580e92639303b90052779c56ba2004f980bc9 (diff)
downloadbox64-ed3450388bb10f917d8b1fd2efb5c2a302bffeac.tar.gz
box64-ed3450388bb10f917d8b1fd2efb5c2a302bffeac.zip
[ARM64_DYNAREC] Some various fixes after double-check of code
Diffstat (limited to 'src')
-rw-r--r--src/dynarec/arm64/dynarec_arm64_helper.c5
-rw-r--r--src/emu/x87emu_private.c11
2 files changed, 9 insertions, 7 deletions
diff --git a/src/dynarec/arm64/dynarec_arm64_helper.c b/src/dynarec/arm64/dynarec_arm64_helper.c
index cd54c728..34704e73 100644
--- a/src/dynarec/arm64/dynarec_arm64_helper.c
+++ b/src/dynarec/arm64/dynarec_arm64_helper.c
@@ -696,6 +696,7 @@ void iret_to_epilog(dynarec_arm_t* dyn, int ninst, int is64bits)
     MAYUSE(ninst);
     MESSAGE(LOG_DUMP, "IRet to epilog\n");
     SMEND();
+    SET_DFNONE(x2);
     // POP IP
     NOTEST(x2);
     if(is64bits) {
@@ -893,7 +894,7 @@ void x87_unstackcount(dynarec_arm_t* dyn, int ninst, int scratch, int count)
         return;
     if(dyn->n.mmxcount)
         mmx_purgecache(dyn, ninst, 0, scratch);
-    MESSAGE(LOG_DUMP, "\tUnsynch x87 Stackcount (%d)\n", count);
+    MESSAGE(LOG_DUMP, "\tUnsynch x87 Unstackcount (%d)\n", count);
     int a = -count;
     // Add x87stack to emu fpu_stack
     LDRw_U12(scratch, xEmu, offsetof(x64emu_t, fpu_stack));
@@ -1071,7 +1072,7 @@ void x87_purgecache(dynarec_arm_t* dyn, int ninst, int next, int s1, int s2, int
         }
         ANDw_mask(s2, s2, 0, 2);
         STRw_U12(s2, xEmu, offsetof(x64emu_t, top));
-        // update tags (and top at the same time)
+        // update tags
         LDRH_U12(s1, xEmu, offsetof(x64emu_t, fpu_tags));
         if(a>0) {
             LSLw_IMM(s1, s1, a*2);
diff --git a/src/emu/x87emu_private.c b/src/emu/x87emu_private.c
index 0ad3db8c..922dbe06 100644
--- a/src/emu/x87emu_private.c
+++ b/src/emu/x87emu_private.c
@@ -13,9 +13,8 @@ void fpu_do_free(x64emu_t* emu, int i)
 {
     emu->fpu_tags |= 0b11 << (i);   // empty
     // check if all empty
-    for(int j=0; j<8; ++j)
-        if(emu->fpu_tags != TAGS_EMPTY)
-            return;
+    if(emu->fpu_tags != TAGS_EMPTY)
+        return;
     emu->fpu_stack = 0;
 }
 
@@ -376,8 +375,9 @@ void fpu_fxrstor32(x64emu_t* emu, void* ed)
         applyFlushTo0(emu);
     emu->top = emu->sw.f.F87_TOP;
     uint8_t tags = p->TagWord;
+    emu->fpu_tags = 0;
     for (int i=0; i<8; ++i)
-        tags |= ((emu->fpu_tags>>(i*2))&0b11)?0:1;
+        emu->fpu_tags |= (((tags>>(i*2))&1)?0:0b11)<<(i*2);
     int top = emu->top&7;
     int stack = 8-top;
     if(top==0)  // check if stack is full or empty, based on tag[0]
@@ -399,8 +399,9 @@ void fpu_fxrstor64(x64emu_t* emu, void* ed)
         applyFlushTo0(emu);
     emu->top = emu->sw.f.F87_TOP;
     uint8_t tags = p->TagWord;
+    emu->fpu_tags = 0;
     for(int i=0; i<8; ++i)
-        emu->fpu_tags |= ((tags>>i)?0:0b11)<<(i*2);
+        emu->fpu_tags |= (((tags>>i)&1)?0:0b11)<<(i*2);
     int top = emu->top&7;
     int stack = 8-top;
     if(top==0)  // check if stack is full or empty, based on tag[0]