about summary refs log tree commit diff stats
path: root/src/emu/x64runda.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/x64runda.c')
-rw-r--r--src/emu/x64runda.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/emu/x64runda.c b/src/emu/x64runda.c
index aed775f9..056937e7 100644
--- a/src/emu/x64runda.c
+++ b/src/emu/x64runda.c
@@ -1,4 +1,5 @@
 #define _GNU_SOURCE

+#include <fenv.h>

 #include <stdint.h>

 #include <stdio.h>

 #include <stdlib.h>

@@ -17,6 +18,7 @@
 #include "x64primop.h"

 #include "x64trace.h"

 #include "x87emu_private.h"

+#include "x87emu_setround.h"

 #include "box64context.h"

 #include "bridge.h"

 

@@ -94,7 +96,8 @@ uintptr_t RunDA(x64emu_t *emu, rex_t rex, uintptr_t addr)
 

     default:

         return 0;

-    } else

+    } else {

+        int oldround = fpu_setround(emu);

         switch((nextop>>3)&7) {

             case 0:     /* FIADD ST0, Ed int */

                 GETE4(0);

@@ -130,5 +133,7 @@ uintptr_t RunDA(x64emu_t *emu, rex_t rex, uintptr_t addr)
                 ST0.d = (double)ED->sdword[0] / ST0.d;

                 break;

         }

+        fesetround(oldround);

+    }

    return addr;

 }
\ No newline at end of file