about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-02-16 13:06:39 +0100
committerptitSeb <sebastien.chev@gmail.com>2023-02-16 13:06:39 +0100
commit39ebeb2401c935bbd7d487b2fcc50cc520cbc31c (patch)
tree0a68cf2c62bc3652c95996ba3b4a638e0d45d2d9 /src
parent8f4e8ed1e7b6dff16396a84c5cb23ab72008035a (diff)
downloadbox64-39ebeb2401c935bbd7d487b2fcc50cc520cbc31c.tar.gz
box64-39ebeb2401c935bbd7d487b2fcc50cc520cbc31c.zip
Fixed interpretor for FIST(P) opcodes
Diffstat (limited to 'src')
-rw-r--r--src/emu/x64rundb.c8
-rw-r--r--src/emu/x64rundf.c2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/emu/x64rundb.c b/src/emu/x64rundb.c
index 6581b727..5791b58d 100644
--- a/src/emu/x64rundb.c
+++ b/src/emu/x64rundb.c
@@ -133,7 +133,7 @@ uintptr_t RunDB(x64emu_t *emu, rex_t rex, uintptr_t addr)
                 break;

             case 1: /* FISTTP Ed, ST0 */

                 GETED(0);

-                if(isgreater(ST0.d, (double)(int32_t)0x7fffffff) || isless(ST0.d, -(double)(int32_t)0x7fffffff) || !isfinite(ST0.d))

+                if(isgreater(ST0.d, (double)(int32_t)0x7fffffff) || isless(ST0.d, (double)(int32_t)0x80000000) || !isfinite(ST0.d))

                     ED->sdword[0] = 0x80000000;

                 else

                     ED->sdword[0] = ST0.d;

@@ -141,7 +141,7 @@ uintptr_t RunDB(x64emu_t *emu, rex_t rex, uintptr_t addr)
                 break;

             case 2: /* FIST Ed, ST0 */

                 GETED(0);

-                if(isgreater(ST0.d, (double)(int32_t)0x7fffffff) || isless(ST0.d, -(double)(int32_t)0x80000000) || !isfinite(ST0.d))

+                if(isgreater(ST0.d, (double)(int32_t)0x7fffffff) || isless(ST0.d, (double)(int32_t)0x80000000) || !isfinite(ST0.d))

                     ED->sdword[0] = 0x80000000;

                 else {

                     volatile int32_t tmp = fpu_round(emu, ST0.d);    // tmp to avoid BUS ERROR

@@ -150,7 +150,7 @@ uintptr_t RunDB(x64emu_t *emu, rex_t rex, uintptr_t addr)
                 break;

             case 3: /* FISTP Ed, ST0 */

                 GETED(0);

-                if(isgreater(ST0.d, (double)(int32_t)0x7fffffff) || isless(ST0.d, -(double)(int32_t)0x80000000) || !isfinite(ST0.d))

+                if(isgreater(ST0.d, (double)(int32_t)0x7fffffff) || isless(ST0.d, (double)(int32_t)0x80000000) || !isfinite(ST0.d))

                     ED->sdword[0] = 0x80000000;

                 else {

                     volatile int32_t tmp = fpu_round(emu, ST0.d);    // tmp to avoid BUS ERROR

@@ -178,4 +178,4 @@ uintptr_t RunDB(x64emu_t *emu, rex_t rex, uintptr_t addr)
         }

     }

   return addr;

-}
\ No newline at end of file
+}

diff --git a/src/emu/x64rundf.c b/src/emu/x64rundf.c
index 3b2b53e6..657c1a48 100644
--- a/src/emu/x64rundf.c
+++ b/src/emu/x64rundf.c
@@ -165,7 +165,7 @@ uintptr_t RunDF(x64emu_t *emu, rex_t rex, uintptr_t addr)
             if(STll(0).sref==ST(0).sq)

                 ED->sq[0] = STll(0).sq;

             else {

-                if(isgreater(ST0.d, (double)(int64_t)0x7fffffffffffffffLL) || isless(ST0.d, -(double)(int64_t)0x8000000000000000LL) || !isfinite(ST0.d))

+                if(isgreater(ST0.d, (double)(int64_t)0x7fffffffffffffffLL) || isless(ST0.d, (double)(int64_t)0x8000000000000000LL) || !isfinite(ST0.d))

                     ED->sq[0] = 0x8000000000000000LL;

                 else

                     ED->sq[0] = fpu_round(emu, ST0.d);