* [Qemu-devel] [PATCH] Compilation errors on BSD
@ 2006-01-07 3:14 andrzej zaborowski
2006-01-07 4:03 ` André Braga
0 siblings, 1 reply; 3+ messages in thread
From: andrzej zaborowski @ 2006-01-07 3:14 UTC (permalink / raw)
To: qemu-devel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] Compilation errors on BSD
2006-01-07 3:14 [Qemu-devel] [PATCH] Compilation errors on BSD andrzej zaborowski
@ 2006-01-07 4:03 ` André Braga
2006-01-07 4:42 ` andrzej zaborowski
0 siblings, 1 reply; 3+ messages in thread
From: André Braga @ 2006-01-07 4:03 UTC (permalink / raw)
To: qemu-devel
On 1/7/06, andrzej zaborowski <balrogg@gmail.com> wrote:
> 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
Sorry if what I'm about to say sounds like a cold shower to you,
but... QEMU as available in the ports collection has patches to work
around this, and even includes some interesting hacks (namely the DMA
patch) to make QEMU more responsive.
Same goes to KQEMU, which is in the ports collection as well.
Still, thanks for bringing this up again. I really think the QEMU
build system should support BSDs out of the box and these patches have
been available for quite some time; I fail to realise why Fabrice
hasn't integrated them yet.
--
"I decry the current tendency to seek patents on algorithms. There are
better ways to earn a living than to prevent other people from making
use of one's contributions to computer science."
Donald Knuth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] Compilation errors on BSD
2006-01-07 4:03 ` André Braga
@ 2006-01-07 4:42 ` andrzej zaborowski
0 siblings, 0 replies; 3+ messages in thread
From: andrzej zaborowski @ 2006-01-07 4:42 UTC (permalink / raw)
To: qemu-devel
Oh well, :-p
The funny thing is I didn't have the Ports availiable at the moment
because I was just about to upgrade my outdated FreeBSD installation
to 6.0 and I was going to use QEMU for this purpose.
I have to agree about that the CVS and the release tarball from the
website should also have this kind of changes applied to make it
cross-platform.
Greetings,
--
balrog 2oo6
Dear Outlook users: Please remove me from your address books
http://www.newsforge.com/article.pl?sid=03/08/21/143258
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-01-07 4:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-07 3:14 [Qemu-devel] [PATCH] Compilation errors on BSD andrzej zaborowski
2006-01-07 4:03 ` André Braga
2006-01-07 4:42 ` andrzej zaborowski
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).