Index: qemu/Makefile @@ -49,7 +49,10 @@ -include config-all-devices.mak -build-all: $(DOCS) $(TOOLS) recurse-all +build-all: $(DOCS) $(TOOLS) bsd/libmath.a recurse-all + +bsd/libmath.a: + ( cd bsd ; unset MAKEFLAGS ; $(BSD_MAKE) CC=$(CC) ) config-host.h: config-host.h-timestamp config-host.h-timestamp: config-host.mak @@ -237,6 +240,7 @@ clean: # avoid old build problems by removing potentially incorrect old files + ( cd bsd ; $(BSD_MAKE) clean ) rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~ rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d Index: qemu/Makefile.target @@ -312,8 +312,8 @@ endif # CONFIG_SOFTMMU obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o -$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) - $(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)) +$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) ../bsd/libmath.a + $(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) ../bsd/libmath.a) gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/feature_to_c.sh Index: qemu/fpu/softfloat-native.c @@ -9,7 +9,8 @@ void set_float_rounding_mode(int val STATUS_PARAM) { STATUS(float_rounding_mode) = val; -#if (defined(CONFIG_BSD) && !defined(__APPLE__) && !defined(__GLIBC__)) || \ +#if (defined(CONFIG_BSD) && !defined(__APPLE__) && !defined(__GLIBC__) && \ + !defined(__FreeBSD__)) || \ (defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10) fpsetround(val); #elif defined(__arm__) @@ -26,7 +27,7 @@ void set_floatx80_rounding_precision(int } #endif -#if defined(CONFIG_BSD) || \ +#if (defined(CONFIG_BSD) && !defined(__FreeBSD__)) || \ (defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10) #define lrint(d) ((int32_t)rint(d)) #define llrint(d) ((int64_t)rint(d)) Index: qemu/fpu/softfloat-native.h @@ -3,7 +3,28 @@ #if (defined(CONFIG_BSD) && !defined(__APPLE__) && !defined(__GLIBC__)) \ || defined(CONFIG_SOLARIS) +#ifdef __FreeBSD__ +#include +long double fabsl(long double x); +long double remainderl(long double x, long double y); +long double sqrtl(long double x); +long double rintl(long double x); +long lrintl(long double x); +long long llrintl(long double x); +#endif + +#if (defined(CONFIG_BSD) && !defined(__APPLE__) && !defined(__GLIBC__) && \ + (!defined(__FreeBSD__) || __FreeBSD_version < 500000)) || \ + defined(CONFIG_SOLARIS) #include +#if defined(__FreeBSD__) +#define isgreater(x, y) __builtin_isgreater((x), (y)) +#define isgreaterequal(x, y) __builtin_isgreaterequal((x), (y)) +#define isless(x, y) __builtin_isless((x), (y)) +#define islessequal(x, y) __builtin_islessequal((x), (y)) +#define islessgreater(x, y) __builtin_islessgreater((x), (y)) +#define isunordered(x, y) __builtin_isunordered((x), (y)) +#endif #define fabsf(f) ((float)fabs(f)) #else #include @@ -113,8 +134,9 @@ typedef union { /*---------------------------------------------------------------------------- | Software IEC/IEEE floating-point rounding mode. *----------------------------------------------------------------------------*/ -#if (defined(CONFIG_BSD) && !defined(__APPLE__) && !defined(__GLIBC__)) \ - || defined(CONFIG_SOLARIS) +#if (defined(CONFIG_BSD) && !defined(__APPLE__) && !defined(__GLIBC__) && \ + (!defined(__FreeBSD__) || __FreeBSD_version < 500000)) || \ + defined(CONFIG_SOLARIS) #if defined(__OpenBSD__) #define FE_RM FP_RM #define FE_RP FP_RP Index: qemu/fpu/softfloat.h @@ -90,7 +90,8 @@ #define FLOAT128 #else /* native float support */ -#if (defined(__i386__) || defined(__x86_64__)) && !defined(CONFIG_BSD) +#if (defined(__i386__) || defined(__x86_64__)) && \ + (!defined(CONFIG_BSD) || defined(__FreeBSD__)) #define FLOATX80 #endif #endif /* !CONFIG_SOFTFLOAT */ Index: qemu/target-ppc/op_helper.c @@ -293,6 +293,13 @@ uint32_t exp = (u.ll >> 52) & 0x7FF; return ((0 < exp) && (exp < 0x7FF)); } +#else +#ifndef isnormal +#define isnormal(x) \ + ((sizeof (x) == sizeof (float)) ? __isnormalf(x) \ + : (sizeof (x) == sizeof (double)) ? __isnormal(x) \ + : __isnormall(x)) +#endif #endif uint32_t helper_compute_fprf (uint64_t arg, uint32_t set_fprf)