qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Patches for qemu-cvs on NetBSD2.0 [partial]


From: Hubert Feyrer
Subject: [Qemu-devel] Patches for qemu-cvs on NetBSD2.0 [partial]
Date: Thu, 3 Mar 2005 02:07:21 +0100 (CET)


The patch below is against the CVS version of qemu, to accommodate all the patches that are in NetBSD's pkgsrc right now, plus a few more that are needed after 0.6.1. The patch is not complete, as there are a number of non-portable changes in the CVS version that prevent qemu from building on NetBSD 2.0/i386.

Remaining problems right now:
 * QEMU_SYSCALL macros in osdep.c
 * Many places where <linux/*> is pulled in. *yuck*
 * Many undefined/unknown symbols referenced: EIP, TRAPNO, ERR,
   REG_EAX, REG_ECX, ...

It would be very nice to have qemu compiling on NetBSD again.
If someone wants me to test-compile something, let me know.


 - Hubert


? i386-hardmmu
? run_me
? soft
Index: Makefile
===================================================================
RCS file: /cvsroot/qemu/qemu/Makefile,v
retrieving revision 1.82
diff -u -r1.82 Makefile
--- Makefile    10 Feb 2005 21:48:51 -0000      1.82
+++ Makefile    3 Mar 2005 01:01:01 -0000
@@ -1,10 +1,10 @@
 -include config-host.mak

-CFLAGS=-Wall -O2 -g -fno-strict-aliasing +#CFLAGS=-Wall -O2 -g -fno-strict-aliasing
 ifdef CONFIG_DARWIN
 CFLAGS+= -mdynamic-no-pic
 endif
-LDFLAGS=-g
+#LDFLAGS=-g
 LIBS=
 DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 TOOLS=qemu-img$(EXESUF)
@@ -85,11 +85,11 @@
        texi2html -monolithic -number $<

 qemu.1: qemu-doc.texi
-       ./texi2pod.pl $< qemu.pod
+       perl texi2pod.pl $< qemu.pod
        pod2man --section=1 --center=" " --release=" " qemu.pod > $@

 qemu-img.1: qemu-img.texi
-       ./texi2pod.pl $< qemu-img.pod
+       perl texi2pod.pl $< qemu-img.pod
        pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@

 FILE=qemu-$(shell cat VERSION)
Index: Makefile.target
===================================================================
RCS file: /cvsroot/qemu/qemu/Makefile.target,v
retrieving revision 1.59
diff -u -r1.59 Makefile.target
--- Makefile.target     1 Mar 2005 21:37:28 -0000       1.59
+++ Makefile.target     3 Mar 2005 01:01:01 -0000
@@ -14,9 +14,9 @@
 VPATH+=:$(SRC_PATH)/linux-user
 DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
 endif
-CFLAGS=-Wall -O2 -g -fno-strict-aliasing
+#CFLAGS=-Wall -O2 -g -fno-strict-aliasing
 #CFLAGS+=-Werror
-LDFLAGS=-g
+#LDFLAGS=-g
 LIBS=
 HELPER_CFLAGS=$(CFLAGS)
 DYNGEN=../dyngen$(EXESUF)
@@ -211,6 +211,9 @@

 DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 LIBS+=-lm
+ifdef CONFIG_DARWIN
+LIBS+=-lmx
+endif
 ifndef CONFIG_USER_ONLY
 LIBS+=-lz
 endif
@@ -446,7 +449,7 @@

 install: all
 ifneq ($(PROGS),)
-       install -m 755 -s $(PROGS) "$(bindir)"
+       $(BSD_INSTALL_PROGRAM) $(PROGS) "$(bindir)"
 endif

 ifneq ($(wildcard .depend),)
Index: bswap.h
===================================================================
RCS file: /cvsroot/qemu/qemu/bswap.h,v
retrieving revision 1.5
diff -u -r1.5 bswap.h
--- bswap.h     10 Oct 2004 15:44:19 -0000      1.5
+++ bswap.h     3 Mar 2005 01:01:01 -0000
@@ -5,6 +5,12 @@

 #include <inttypes.h>

+#ifdef HAVE_MACHINE_BSWAP_H
+#include <sys/endian.h>
+#include <sys/types.h>
+#include <machine/bswap.h>
+#else
+
 #ifdef HAVE_BYTESWAP_H
 #include <byteswap.h>
 #else
@@ -58,6 +64,8 @@
     return bswap_64(x);
 }

+#endif /* ! HAVE_MACHINE_BSWAP_H */
+
 static inline void bswap16s(uint16_t *s)
 {
     *s = bswap16(*s);
Index: configure
===================================================================
RCS file: /cvsroot/qemu/qemu/configure,v
retrieving revision 1.59
diff -u -r1.59 configure
--- configure   1 Mar 2005 22:30:41 -0000       1.59
+++ configure   3 Mar 2005 01:01:01 -0000
@@ -285,7 +285,7 @@
 `$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
 sdl_static_libs=`$sdl_config --static-libs`
 if [ "$aa" = "yes" ] ; then
-  sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
+  sdl_static_libs="$sdl_static_libs `aalib-x11-config --static-libs`"
 fi

 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> 
/dev/null; then
@@ -344,7 +344,7 @@
 if test -z "$prefix" ; then
     prefix="/usr/local"
 fi
-mandir="$prefix/share/man"
+mandir="$prefix/man"
 datadir="$prefix/share/qemu"
 docdir="$prefix/share/doc/qemu"
 bindir="$prefix/bin"
@@ -511,6 +511,8 @@
   echo "#define CONFIG_WIN32 1" >> $config_h
 elif test -f "/usr/include/byteswap.h" ; then
   echo "#define HAVE_BYTESWAP_H 1" >> $config_h
+elif test -f "/usr/include/machine/bswap.h" ; then
+  echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
 fi
 if test "$darwin" = "yes" ; then
   echo "CONFIG_DARWIN=yes" >> $config_mak
@@ -676,7 +678,7 @@
         fi
         echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
         if [ "${aa}" = "yes" ] ; then
-            echo -n " `aalib-config --cflags`" >> $config_mak ;
+            echo -n " `aalib-x11-config --cflags`" >> $config_mak ;
         fi
         echo "" >> $config_mak
     fi
Index: dyngen-exec.h
===================================================================
RCS file: /cvsroot/qemu/qemu/dyngen-exec.h,v
retrieving revision 1.21
diff -u -r1.21 dyngen-exec.h
--- dyngen-exec.h       1 Mar 2005 22:30:59 -0000       1.21
+++ dyngen-exec.h       3 Mar 2005 01:01:01 -0000
@@ -23,7 +23,9 @@
 /* NOTE: standard headers should be used with special care at this
    point because host CPU registers are used as global variables. Some
    host headers do not allow that. */
+#ifndef __APPLE__
 #include <stddef.h>
+#endif

 typedef unsigned char uint8_t;
 typedef unsigned short uint16_t;
@@ -43,7 +45,7 @@
 #else
 typedef signed long long int64_t;
 #endif
-
+/*
 #define INT8_MIN               (-128)
 #define INT16_MIN              (-32767-1)
 #define INT32_MIN              (-2147483647-1)
@@ -56,8 +58,12 @@
 #define UINT16_MAX             (65535)
 #define UINT32_MAX             (4294967295U)
 #define UINT64_MAX             ((uint64_t)(18446744073709551615))
-
+*/
+#ifdef __NetBSD__
+typedef        struct __sFILE FILE;
+#else
 typedef struct FILE FILE;
+#endif
 extern int fprintf(FILE *, const char *, ...);
 extern int printf(const char *, ...);
 #undef NULL
@@ -70,6 +76,7 @@
 #define FE_UPWARD      FP_RP
 #define FE_TOWARDZERO  FP_RZ
 #define fesetround(x)  fpsetround(x)
+#define fegetround()  fpgetround()
 #else
 #include <fenv.h>
 #endif
Index: osdep.c
===================================================================
RCS file: /cvsroot/qemu/qemu/osdep.c,v
retrieving revision 1.8
diff -u -r1.8 osdep.c
--- osdep.c     21 Feb 2005 20:10:36 -0000      1.8
+++ osdep.c     3 Mar 2005 01:01:02 -0000
@@ -39,7 +39,9 @@
    the CPU core because it needs to use alternates stacks and
    libc/thread incompatibles settings */

+#ifdef __linux
 #include <linux/unistd.h>
+#endif

 #define QEMU_SYSCALL0(name) \
 { \
Index: osdep.h
===================================================================
RCS file: /cvsroot/qemu/qemu/osdep.h,v
retrieving revision 1.5
diff -u -r1.5 osdep.h
--- osdep.h     10 Feb 2005 21:59:25 -0000      1.5
+++ osdep.h     3 Mar 2005 01:01:02 -0000
@@ -2,6 +2,8 @@
 #define QEMU_OSDEP_H

 #include <stdarg.h>
+#include <sys/types.h>
+#include <sys/signal.h>

 int qemu_vsnprintf(char *buf, int buflen, const char *fmt, va_list args);
 void qemu_vprintf(const char *fmt, va_list ap);
@@ -31,7 +33,7 @@
 struct qemu_sigaction {
     union {
         void (*_sa_handler)(int);
-        void (*_sa_sigaction)(int, struct siginfo *, void *);
+        void (*_sa_sigaction)(int, siginfo_t *, void *);
     } _u;
     unsigned long sa_flags;
     void (*sa_restorer)(void);
Index: vl.c
===================================================================
RCS file: /cvsroot/qemu/qemu/vl.c,v
retrieving revision 1.122
diff -u -r1.122 vl.c
--- vl.c        1 Mar 2005 21:37:28 -0000       1.122
+++ vl.c        3 Mar 2005 01:01:03 -0000
@@ -43,8 +43,10 @@
 #ifdef _BSD
 #include <sys/stat.h>
 #ifndef __APPLE__
+#ifndef _BSD
 #include <libutil.h>
 #endif
+#endif
 #else
 #include <linux/if.h>
 #include <linux/if_tun.h>
@@ -3011,9 +3013,11 @@
     const char *loadvm = NULL;

 #if !defined(CONFIG_SOFTMMU)
+#ifdef __linux
     /* we never want that malloc() uses mmap() */
     mallopt(M_MMAP_THRESHOLD, 4096 * 1024);
 #endif
+#endif
     initrd_filename = NULL;
     for(i = 0; i < MAX_FD; i++)
         fd_filename[i] = NULL;
Index: audio/mixeng.c
===================================================================
RCS file: /cvsroot/qemu/qemu/audio/mixeng.c,v
retrieving revision 1.1
diff -u -r1.1 mixeng.c
--- audio/mixeng.c      7 Nov 2004 18:04:02 -0000       1.1
+++ audio/mixeng.c      3 Mar 2005 01:01:04 -0000
@@ -27,6 +27,8 @@
 #include "audio/mixeng.h"

 #define IN_T int8_t
+#define CONV_IN_T conv_int8_t
+#define CLIP_IN_T clip_int8_t
 #define IN_MIN CHAR_MIN
 #define IN_MAX CHAR_MAX
 #define SIGNED
@@ -34,17 +36,25 @@
 #undef SIGNED
 #undef IN_MAX
 #undef IN_MIN
+#undef CLIP_IN_T
+#undef CONV_IN_T
 #undef IN_T

 #define IN_T uint8_t
+#define CONV_IN_T conv_uint8_t
+#define CLIP_IN_T clip_uint8_t
 #define IN_MIN 0
 #define IN_MAX UCHAR_MAX
 #include "mixeng_template.h"
 #undef IN_MAX
 #undef IN_MIN
+#undef CLIP_IN_T
+#undef CONV_IN_T
 #undef IN_T

 #define IN_T int16_t
+#define CONV_IN_T conv_int16_t
+#define CLIP_IN_T clip_int16_t
 #define IN_MIN SHRT_MIN
 #define IN_MAX SHRT_MAX
 #define SIGNED
@@ -52,17 +62,24 @@
 #undef SIGNED
 #undef IN_MAX
 #undef IN_MIN
+#undef CLIP_IN_T
+#undef CONV_IN_T
 #undef IN_T

 #define IN_T uint16_t
+#define CONV_IN_T conv_uint16_t
+#define CLIP_IN_T clip_uint16_t
 #define IN_MIN 0
 #define IN_MAX USHRT_MAX
 #include "mixeng_template.h"
 #undef IN_MAX
 #undef IN_MIN
+#undef CLIP_IN_T
+#undef CONV_IN_T
 #undef IN_T

 t_sample *mixeng_conv[2][2][2] = {
+#if !defined(__NetBSD__)
     {
         {
             conv_uint8_t_to_mono,
@@ -83,9 +100,11 @@
             conv_int16_t_to_stereo
         }
     }
+#endif /* !__NetBSD__ */
 };

 f_sample *mixeng_clip[2][2][2] = {
+#if !defined(__NetBSD__)
     {
         {
             clip_uint8_t_from_mono,
@@ -106,6 +125,7 @@
             clip_int16_t_from_stereo
         }
     }
+#endif /* !__NetBSD__ */
 };

 /*
Index: audio/ossaudio.c
===================================================================
RCS file: /cvsroot/qemu/qemu/audio/ossaudio.c,v
retrieving revision 1.4
diff -u -r1.4 ossaudio.c
--- audio/ossaudio.c    14 Nov 2004 16:02:51 -0000      1.4
+++ audio/ossaudio.c    3 Mar 2005 01:01:04 -0000
@@ -164,7 +164,7 @@
         goto err;
     }

-    if (ioctl (fd, SNDCTL_DSP_NONBLOCK)) {
+    if (ioctl (fd, SNDCTL_DSP_NONBLOCK, NULL)) {
         dolog ("Could not initialize audio hardware\n"
                "Failed to set non-blocking mode\n"
                "Reason: %s\n",
Index: hw/ide.c
===================================================================
RCS file: /cvsroot/qemu/qemu/hw/ide.c,v
retrieving revision 1.32
diff -u -r1.32 ide.c
--- hw/ide.c    2 Dec 2004 20:20:21 -0000       1.32
+++ hw/ide.c    3 Mar 2005 01:01:06 -0000
@@ -1927,7 +1927,9 @@
                     s->heads = 16;
                     s->sectors = 63;
                 }
+#if 0
                 bdrv_set_geometry_hint(s->bs, s->cylinders, s->heads, 
s->sectors);
+#endif
             }
             if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) {
                 s->is_cdrom = 1;
Index: target-i386/cpu.h
===================================================================
RCS file: /cvsroot/qemu/qemu/target-i386/cpu.h,v
retrieving revision 1.27
diff -u -r1.27 cpu.h
--- target-i386/cpu.h   12 Feb 2005 18:58:00 -0000      1.27
+++ target-i386/cpu.h   3 Mar 2005 01:01:06 -0000
@@ -609,9 +609,15 @@
 /* you can call this signal handler from your SIGBUS and SIGSEGV
    signal handlers to inform the virtual CPU of exceptions. non zero
    is returned if the signal was handled by the virtual CPU.  */
+#ifdef __NetBSD__
+union siginfo;
+int cpu_x86_signal_handler(int host_signum, union siginfo *info, + void *puc);
+#else
 struct siginfo;
 int cpu_x86_signal_handler(int host_signum, struct siginfo *info,
                            void *puc);
+#endif
 void cpu_x86_set_a20(CPUX86State *env, int a20_state);

 uint64_t cpu_get_tsc(CPUX86State *env);
Index: target-i386/exec.h
===================================================================
RCS file: /cvsroot/qemu/qemu/target-i386/exec.h,v
retrieving revision 1.22
diff -u -r1.22 exec.h
--- target-i386/exec.h  1 Mar 2005 22:33:39 -0000       1.22
+++ target-i386/exec.h  3 Mar 2005 01:01:06 -0000
@@ -377,8 +377,8 @@
 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))
+#define lrint(d)               ((long)rint(d))
+#define llrint(d)              ((long long)rint(d))
 #endif
 extern CPU86_LDouble fabs(CPU86_LDouble x);
 extern CPU86_LDouble sin(CPU86_LDouble x);
Index: target-ppc/cpu.h
===================================================================
RCS file: /cvsroot/qemu/qemu/target-ppc/cpu.h,v
retrieving revision 1.15
diff -u -r1.15 cpu.h
--- target-ppc/cpu.h    15 Feb 2005 23:06:19 -0000      1.15
+++ target-ppc/cpu.h    3 Mar 2005 01:01:06 -0000
@@ -163,9 +163,15 @@
 /* you can call this signal handler from your SIGBUS and SIGSEGV
    signal handlers to inform the virtual CPU of exceptions. non zero
    is returned if the signal was handled by the virtual CPU.  */
+#ifdef __NetBSD__
+union siginfo;
+int cpu_ppc_signal_handler(int host_signum, union siginfo *info, + void *puc);
+#else
 struct siginfo;
 int cpu_ppc_signal_handler(int host_signum, struct siginfo *info,
                            void *puc);
+#endif

 void do_interrupt (CPUPPCState *env);
 void cpu_loop_exit(void);
Index: target-ppc/exec.h
===================================================================
RCS file: /cvsroot/qemu/qemu/target-ppc/exec.h,v
retrieving revision 1.9
diff -u -r1.9 exec.h
--- target-ppc/exec.h   3 Jan 2005 23:42:39 -0000       1.9
+++ target-ppc/exec.h   3 Mar 2005 01:01:06 -0000
@@ -20,6 +20,7 @@
 #if !defined (__PPC_H__)
 #define __PPC_H__

+#include "config.h"
 #include "dyngen-exec.h"

 register struct CPUPPCState *env asm(AREG0);
Index: target-sparc/cpu.h
===================================================================
RCS file: /cvsroot/qemu/qemu/target-sparc/cpu.h,v
retrieving revision 1.15
diff -u -r1.15 cpu.h
--- target-sparc/cpu.h  22 Feb 2005 19:08:57 -0000      1.15
+++ target-sparc/cpu.h  3 Mar 2005 01:01:06 -0000
@@ -189,8 +189,7 @@
        cpu_set_cwp(env, _tmp & PSR_CWP & (NWINDOWS - 1));              \
     } while (0)

-struct siginfo;
-int cpu_sparc_signal_handler(int hostsignum, struct siginfo *info, void *puc);
+int cpu_sparc_signal_handler(int hostsignum, siginfo_t *info, void *puc);

 #define TARGET_PAGE_BITS 12 /* 4k */
 #include "cpu-all.h"
Index: target-sparc/exec.h
===================================================================
RCS file: /cvsroot/qemu/qemu/target-sparc/exec.h,v
retrieving revision 1.10
diff -u -r1.10 exec.h
--- target-sparc/exec.h 13 Feb 2005 19:02:42 -0000      1.10
+++ target-sparc/exec.h 3 Mar 2005 01:01:06 -0000
@@ -1,5 +1,6 @@
 #ifndef EXEC_SPARC_H
 #define EXEC_SPARC_H 1
+#include "config.h"
 #include "dyngen-exec.h"

 register struct CPUSPARCState *env asm(AREG0);
Index: target-sparc/op_helper.c
===================================================================
RCS file: /cvsroot/qemu/qemu/target-sparc/op_helper.c,v
retrieving revision 1.9
diff -u -r1.9 op_helper.c
--- target-sparc/op_helper.c    22 Feb 2005 19:14:33 -0000      1.9
+++ target-sparc/op_helper.c    3 Mar 2005 01:01:06 -0000
@@ -1,5 +1,4 @@
 #include <math.h>
-#include <fenv.h>
 #include "exec.h"

 //#define DEBUG_MMU

--
NetBSD - Free AND Open!      (And of course secure, portable, yadda yadda)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]