about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-04-29 22:50:24 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-04-29 22:50:24 +0200
commitd1555a4c782ed97985c3c5f0db3f725f13cf331b (patch)
tree31a697fba5bd1790d48c9a5032a91472ba344d1b /src
parent5fc4477a94ebf8b15ace909c98bde32ff6d1deea (diff)
downloadbox64-d1555a4c782ed97985c3c5f0db3f725f13cf331b.tar.gz
box64-d1555a4c782ed97985c3c5f0db3f725f13cf331b.zip
[ARM64_DYNAREC] Fixed some more issue on x87 handling
Diffstat (limited to 'src')
-rw-r--r--src/dynarec/arm64/dynarec_arm64_helper.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/dynarec/arm64/dynarec_arm64_helper.c b/src/dynarec/arm64/dynarec_arm64_helper.c
index 6544fc51..2d53ce59 100644
--- a/src/dynarec/arm64/dynarec_arm64_helper.c
+++ b/src/dynarec/arm64/dynarec_arm64_helper.c
@@ -2070,6 +2070,13 @@ static void fpuCacheTransform(dynarec_arm_t* dyn, int ninst, int s1, int s2, int
         STRw_U12(s3, xEmu, offsetof(x64emu_t, fpu_stack));
         // Sub x87stack to top, with and 7
         LDRw_U12(s3, xEmu, offsetof(x64emu_t, top));
+        if(a>0) {
+            SUBw_U12(s3, s3, a);
+        } else {
+            ADDw_U12(s3, s3, -a);
+        }
+        ANDw_mask(s3, s3, 0, 2);   //mask=7
+        STRw_U12(s3, xEmu, offsetof(x64emu_t, top));
         // update tags
         LDRH_U12(s2, xEmu, offsetof(x64emu_t, fpu_tags));
         if(a>0) {
@@ -2079,7 +2086,6 @@ static void fpuCacheTransform(dynarec_arm_t* dyn, int ninst, int s1, int s2, int
             LSRw_IMM(s2, s2, -a*2);
         }
         STRH_U12(s2, xEmu, offsetof(x64emu_t, fpu_tags));
-        STRw_U12(s3, xEmu, offsetof(x64emu_t, top));
         s3_top = 0;
         stack_cnt = cache_i2.stack;
     }