aboutsummaryrefslogtreecommitdiff
path: root/emulators/qemu-devel/files/patch-bh
blob: 52dff1c7160e95f2c25084d9ecd62be9ffab68fd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Index: qemu/dyngen-exec.h
===================================================================
RCS file: /cvsroot/qemu/qemu/dyngen-exec.h,v
retrieving revision 1.12
diff -w -u -d -r1.12 dyngen-exec.h
--- dyngen-exec.h	12 May 2004 19:32:15 -0000	1.12
+++ dyngen-exec.h	21 May 2004 15:00:41 -0000
@@ -21,6 +21,8 @@
 #define __DYNGEN_EXEC_H__
 
 #include <stddef.h>
+#include <stdio.h>
+#include "config.h"
 
 typedef unsigned char uint8_t;
 typedef unsigned short uint16_t;
@@ -54,9 +56,6 @@
 #define UINT32_MAX		(4294967295U)
 #define UINT64_MAX		((uint64_t)(18446744073709551615))
 
-typedef struct FILE FILE;
-extern int fprintf(FILE *, const char *, ...);
-extern int printf(const char *, ...);
 #undef NULL
 #define NULL 0
 #ifdef _BSD
Index: qemu/target-ppc/op_helper.c
===================================================================
RCS file: /cvsroot/qemu/qemu/target-ppc/op_helper.c,v
retrieving revision 1.6
diff -w -u -d -r1.6 op_helper.c
--- target-ppc/op_helper.c	21 May 2004 12:59:31 -0000	1.6
+++ target-ppc/op_helper.c	21 May 2004 15:00:49 -0000
@@ -210,6 +210,22 @@
     }
     /* TODO: update FEX & VX */
     /* Set rounding mode */
+#ifdef _BSD
+    switch(env->fpscr[0] & 0x3) {
+    case 0:
+        fpsetround(FP_RN);
+        break;
+    case 1:
+        fpsetround(FP_RZ);
+        break;
+    case 2:
+        fpsetround(FP_RP);
+        break;
+    case 3:
+        fpsetround(FP_RM);
+        break;
+    }
+#else
     switch (env->fpscr[0] & 0x3) {
     case 0:
         /* Best approximation (round to nearest) */
@@ -228,6 +244,7 @@
         fesetround(FE_DOWNWARD);
         break;
     }
+#endif
 }
 
 void do_fctiw (void)
@@ -253,9 +270,13 @@
         double d;
         uint64_t i;
     } *p = (void *)&FT1;
+#ifdef _BSD
+    int cround = fpgetround();
+    fpsetround(FP_RZ);
+#else
     int cround = fegetround();
-
     fesetround(FE_TOWARDZERO);
+#endif
     if (FT0 > (double)0x7FFFFFFF)
         p->i = 0x7FFFFFFFULL << 32;
     else if (FT0 < -(double)0x80000000)
@@ -264,7 +285,11 @@
         p->i = 0;
     p->i |= (uint32_t)FT0;
     FT0 = p->d;
+#ifdef _BSD
+    fpsetround(cround);
+#else
     fesetround(cround);
+#endif
 }
 
 void do_fnmadds (void)