qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: andrzej zaborowski <balrogg@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Compilation errors on BSD
Date: Sat, 7 Jan 2006 04:14:39 +0100	[thread overview]
Message-ID: <fb249edb0601061914r13a83561j@mail.gmail.com> (raw)

Hiyas,
Today I tried compiling QEMU on a FreeBSD computer and it spitted at
me a bunch of errors, all of them being results of trivial differences
in system headers. The following patch fixed them and I got a working
QEMU 0.8.0, in case anyone's interested. There was also another
trivial change needed to get KQEMU working (but this I will keep for
myself, to be alright with the license). As far as I have checked,
compiling on OpenBSD would require these same changes.
Greetings,
Andrew

diff -Naur qemu-0.8.0/dyngen-exec.h qemu-0.8.0-fbsd/dyngen-exec.h
--- qemu-0.8.0/dyngen-exec.h    Mon Dec 19 22:51:53 2005
+++ qemu-0.8.0-fbsd/dyngen-exec.h       Sat Jan  7 01:41:47 2006
@@ -25,23 +25,47 @@
    host headers do not allow that. */
 #include <stddef.h>

+#if !defined(_UINT8_T_DECLARED)
 typedef unsigned char uint8_t;
+#define _UINT8_T_DECLARED
+#endif
+#if !defined(_UINT16_T_DECLARED)
 typedef unsigned short uint16_t;
+#define _UINT16_T_DECLARED
+#endif
+#if !defined(_UINT32_T_DECLARED)
 typedef unsigned int uint32_t;
+#define _UINT32_T_DECLARED
+#endif
+#if !defined(_UINT64_T_DECLARED)
 /* XXX may be done for all 64 bits targets ? */
 #if defined (__x86_64__) || defined(__ia64)
 typedef unsigned long uint64_t;
 #else
 typedef unsigned long long uint64_t;
 #endif
+#define _UINT64_T_DECLARED
+#endif

+#if !defined(_INT8_T_DECLARED)
 typedef signed char int8_t;
+#define _INT8_T_DECLARED
+#endif
+#if !defined(_INT16_T_DECLARED)
 typedef signed short int16_t;
+#define _INT16_T_DECLARED
+#endif
+#if !defined(_INT32_T_DECLARED)
 typedef signed int int32_t;
+#define _INT32_T_DECLARED
+#endif
+#if !defined(_INT6_T_DECLARED)
 #if defined (__x86_64__) || defined(__ia64)
 typedef signed long int64_t;
 #else
 typedef signed long long int64_t;
+#endif
+#define _INT64_T_DECLARED
 #endif

 #define INT8_MIN               (-128)
diff -Naur qemu-0.8.0/fpu/softfloat-native.c
qemu-0.8.0-fbsd/fpu/softfloat-nativ e.c
--- qemu-0.8.0/fpu/softfloat-native.c   Mon Dec 19 22:51:53 2005
+++ qemu-0.8.0-fbsd/fpu/softfloat-native.c      Sat Jan  7 01:56:24 2006
@@ -85,7 +85,11 @@
 *----------------------------------------------------------------------------*/
 int float32_to_int32( float32 a STATUS_PARAM)
 {
+#ifdef _BSD
+    return (int)rintf(a);
+#else
     return lrintf(a);
+#endif
 }
 int float32_to_int32_round_to_zero( float32 a STATUS_PARAM)
 {
@@ -93,7 +97,11 @@
 }
 int64_t float32_to_int64( float32 a STATUS_PARAM)
 {
+#ifdef _BSD
+    return (int64_t)rintf(a);
+#else
     return llrintf(a);
+#endif
 }

 int64_t float32_to_int64_round_to_zero( float32 a STATUS_PARAM)
diff -Naur qemu-0.8.0/fpu/softfloat-native.h
qemu-0.8.0-fbsd/fpu/softfloat-nativ e.h
--- qemu-0.8.0/fpu/softfloat-native.h   Mon Dec 19 22:51:53 2005
+++ qemu-0.8.0-fbsd/fpu/softfloat-native.h      Sat Jan  7 01:35:40 2006
@@ -36,9 +36,9 @@
 #if defined(_BSD) && !defined(__APPLE__)
 enum {
     float_round_nearest_even = FP_RN,
-    float_round_down         = FE_RM,
-    float_round_up           = FE_RP,
-    float_round_to_zero      = FE_RZ
+    float_round_down         = FP_RM,
+    float_round_up           = FP_RP,
+    float_round_to_zero      = FP_RZ
 };
 #elif defined(__arm__)
 enum {
diff -Naur qemu-0.8.0/osdep.c qemu-0.8.0-fbsd/osdep.c
--- qemu-0.8.0/osdep.c  Mon Dec 19 22:51:53 2005
+++ qemu-0.8.0-fbsd/osdep.c     Sat Jan  7 01:28:22 2006
@@ -323,7 +323,13 @@

 #elif defined(USE_KQEMU)

+#if defined(_BSD)
+#include <sys/param.h>
+#include <sys/mount.h>
+#else
 #include <sys/vfs.h>
+#endif
+
 #include <sys/mman.h>
 #include <fcntl.h>

--
balrog 2oo6

Dear Outlook users: Please remove me from your address books
http://www.newsforge.com/article.pl?sid=03/08/21/143258

             reply	other threads:[~2006-01-07  3:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-07  3:14 andrzej zaborowski [this message]
2006-01-07  4:03 ` [Qemu-devel] [PATCH] Compilation errors on BSD André Braga
2006-01-07  4:42   ` andrzej zaborowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fb249edb0601061914r13a83561j@mail.gmail.com \
    --to=balrogg@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).