aboutsummaryrefslogtreecommitdiff
path: root/target-i386
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-05-12 19:32:15 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-05-12 19:32:15 +0000
commit7d3505c55aae54c9610e8be1ff476ec8849c98e6 (patch)
tree8e8b024b2e8b547dc48d8024fe5b3001a7c46c0d /target-i386
parentfd872598d8d8cf78c1f12ed9661baf9ac0943c04 (diff)
bsd port (Markus Niemisto)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@800 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/cpu.h2
-rw-r--r--target-i386/exec.h6
-rw-r--r--target-i386/op.c19
3 files changed, 26 insertions, 1 deletions
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 6939a2c6e6..19340d2579 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -259,7 +259,7 @@ enum {
CC_OP_NB,
};
-#if defined(__i386__) || defined(__x86_64__)
+#if (defined(__i386__) || defined(__x86_64__)) && !defined(_BSD)
#define USE_X86LDOUBLE
#endif
diff --git a/target-i386/exec.h b/target-i386/exec.h
index fb9cc772f9..f5b03fbe58 100644
--- a/target-i386/exec.h
+++ b/target-i386/exec.h
@@ -17,6 +17,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "config.h"
#include "dyngen-exec.h"
/* at least 4 register variables are defines */
@@ -307,8 +308,13 @@ static inline void stfl(void *ptr, float v)
#define rint rintl
#endif
+#if !defined(_BSD)
extern int lrint(CPU86_LDouble x);
extern int64_t llrint(CPU86_LDouble x);
+#else
+#define lrint(d) ((int)rint(d))
+#define llrint(d) ((int)rint(d))
+#endif
extern CPU86_LDouble fabs(CPU86_LDouble x);
extern CPU86_LDouble sin(CPU86_LDouble x);
extern CPU86_LDouble cos(CPU86_LDouble x);
diff --git a/target-i386/op.c b/target-i386/op.c
index 37823319d6..fad8a730e7 100644
--- a/target-i386/op.c
+++ b/target-i386/op.c
@@ -1938,6 +1938,24 @@ void OPPROTO op_fldcw_A0(void)
int rnd_type;
env->fpuc = lduw((void *)A0);
/* set rounding mode */
+#ifdef _BSD
+ switch(env->fpuc & RC_MASK) {
+ default:
+ case RC_NEAR:
+ rnd_type = FP_RN;
+ break;
+ case RC_DOWN:
+ rnd_type = FP_RM;
+ break;
+ case RC_UP:
+ rnd_type = FP_RP;
+ break;
+ case RC_CHOP:
+ rnd_type = FP_RZ;
+ break;
+ }
+ fpsetround(rnd_type);
+#else
switch(env->fpuc & RC_MASK) {
default:
case RC_NEAR:
@@ -1954,6 +1972,7 @@ void OPPROTO op_fldcw_A0(void)
break;
}
fesetround(rnd_type);
+#endif
}
void OPPROTO op_fclex(void)