Sorry for such long delays, here is the latest incorporation (I hope) of all
your feedback.

Thanks for testing,
-- 
Todd Fries .. [EMAIL PROTECTED]

 _____________________________________________
|                                             \  1.636.410.0632 (voice)
| Free Daemon Consulting, LLC                 \  1.405.227.9094 (voice)
| http://FreeDaemonConsulting.com             \  1.866.792.3418 (FAX)
| "..in support of free software solutions."  \          250797 (FWD)
|                                             \
 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
                                                 
              37E7 D3EB 74D0 8D66 A68D  B866 0326 204E 3F42 004A
                        http://todd.fries.net/pgp.txt



diff -urN --exclude=CVS qemu.orig/Makefile qemu/Makefile
--- qemu.orig/Makefile  Wed Feb 21 07:18:49 2007
+++ qemu/Makefile       Wed Mar 21 10:32:28 2007
@@ -5,8 +5,7 @@
 
 COMMENT=               "multi system emulator"
 
-DISTNAME=              qemu-0.8.2
-PKGNAME=               ${DISTNAME}p4
+DISTNAME=              qemu-0.9.0
 CATEGORIES=            emulators
 
 HOMEPAGE=              http://fabrice.bellard.free.fr/qemu/
@@ -21,10 +20,8 @@
 MASTER_SITES=          ${HOMEPAGE}
 
 BUILD_DEPENDS=         ::textproc/texi2html
-LIB_DEPENDS=           SDL::devel/sdl
 USE_GMAKE=             Yes
-USE_X11=               Yes
-WANTLIB=               m z ossaudio X11 Xext usbhid pthread c
+WANTLIB=               m z ossaudio c
 CONFIGURE_STYLE=       gnu
 
 # Currently, the regression tests are utterly broken.
@@ -32,6 +29,20 @@
 
 .if ${MACHINE_ARCH} == "amd64"
 PATCH_LIST=     patch-* misc-*
+.endif
+
+FLAVORS=               no_x11
+FLAVOR?=
+
+.if ${FLAVOR:L:Mno_x11}
+CONFIGURE_ARGS+=       --disable-gfx-check \
+                       --disable-sdl
+.else
+LIB_DEPENDS=           SDL::devel/sdl \
+                       aa::graphics/aalib
+
+USE_X11=               Yes
+WANTLIB+=              X11 Xext pthread usbhid
 .endif
 
 post-install:
diff -urN --exclude=CVS qemu.orig/distinfo qemu/distinfo
--- qemu.orig/distinfo  Mon Apr  9 04:40:48 2007
+++ qemu/distinfo       Sat Mar 10 16:37:29 2007
@@ -1,5 +1,5 @@
-MD5 (qemu-0.8.2.tar.gz) = WzqJ6y8laopvO7B/ez8bBw==
-RMD160 (qemu-0.8.2.tar.gz) = cVwkmXMwNSqmdc1yeXMc7CUfgzo=
-SHA1 (qemu-0.8.2.tar.gz) = 13UjmlRefQxbZ3ZgohIt9ZCv3m0=
-SHA256 (qemu-0.8.2.tar.gz) = KiDYESlshZ1ni90AIiKqfKeVGmQTJyNPOvFE6CLQePM=
-SIZE (qemu-0.8.2.tar.gz) = 1810909
+MD5 (qemu-0.9.0.tar.gz) = ab11a03ba30cf4a70641f0f170473d69
+RMD160 (qemu-0.9.0.tar.gz) = 4296542b6da18a6ac93d20787330d3c1c2ac0a19
+SHA1 (qemu-0.9.0.tar.gz) = 1e57e48a06eb8729913d92601000466eecef06cb
+SHA256 (qemu-0.9.0.tar.gz) = 
491facf9335654967ee53d8fb3540a274bfcbdcc225506bd38c4ee8e9ab405c1
+SIZE (qemu-0.9.0.tar.gz) = 1901741
diff -urN --exclude=CVS qemu.orig/patches/patch-Makefile 
qemu/patches/patch-Makefile
--- qemu.orig/patches/patch-Makefile    Fri Dec 22 11:31:45 2006
+++ qemu/patches/patch-Makefile Tue Mar 20 19:22:00 2007
@@ -1,7 +1,16 @@
-$OpenBSD: patch-Makefile,v 1.5 2006/12/22 17:31:45 todd Exp $
---- Makefile.orig      Sat Jul 22 13:23:34 2006
-+++ Makefile   Sun Nov 12 17:10:10 2006
-@@ -44,7 +44,7 @@ clean:
+$OpenBSD$
+--- Makefile.orig      Mon Feb  5 17:01:54 2007
++++ Makefile   Tue Mar 20 19:21:54 2007
+@@ -27,7 +27,7 @@ endif
+ ifndef CONFIG_DARWIN
+ ifndef CONFIG_WIN32
+ ifndef CONFIG_SOLARIS
+-LIBS+=-lrt
++#LIBS+=-lrt
+ endif
+ endif
+ endif
+@@ -51,7 +51,7 @@ clean:
        rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~
        $(MAKE) -C tests clean
        for d in $(TARGET_DIRS); do \
@@ -10,7 +19,7 @@
          done
  
  distclean: clean
-@@ -98,7 +98,7 @@ cscope:
+@@ -106,7 +106,7 @@ cscope:
  
  # documentation
  %.html: %.texi
diff -urN --exclude=CVS qemu.orig/patches/patch-Makefile_target 
qemu/patches/patch-Makefile_target
--- qemu.orig/patches/patch-Makefile_target     Fri Dec 22 11:31:45 2006
+++ qemu/patches/patch-Makefile_target  Tue Apr  3 08:35:34 2007
@@ -1,28 +1,17 @@
-$OpenBSD: patch-Makefile_target,v 1.10 2006/12/22 17:31:45 todd Exp $
---- Makefile.target.orig       Sat Jul 22 13:23:34 2006
-+++ Makefile.target    Mon Dec 18 17:16:21 2006
-@@ -17,8 +17,9 @@ ifdef CONFIG_USER_ONLY
- VPATH+=:$(SRC_PATH)/linux-user
- DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
+$OpenBSD$
+--- Makefile.target.orig       Mon Feb  5 17:01:54 2007
++++ Makefile.target    Tue Apr  3 08:21:24 2007
+@@ -150,7 +150,7 @@ BASE_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
  endif
--CFLAGS=-Wall -O2 -g -fno-strict-aliasing
-+#CFLAGS=-Wall -O2 -g -fno-strict-aliasing
- #CFLAGS+=-Werror
-+CFLAGS+= -ggdb
- LDFLAGS=-g
- LIBS=
- HELPER_CFLAGS=$(CFLAGS)
-@@ -144,7 +145,7 @@ LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64
- endif
  
  ifeq ($(ARCH),arm)
--OP_CFLAGS=$(CFLAGS) -mno-sched-prolog -fno-omit-frame-pointer
-+OP_CFLAGS=$(CFLAGS) -mno-sched-prolog -fno-omit-frame-pointer -mapcs-frame
- LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
+-OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
++OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer -mapcs-frame
+ BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
  endif
  
-@@ -153,6 +154,12 @@ OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
- LDFLAGS+=-Wl,-T,m68k.ld
+@@ -163,6 +163,12 @@ ifeq ($(ARCH),mips)
+ BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
  endif
  
 +# Very important for this 'ifeq' block to be after other
@@ -34,15 +23,15 @@
  ifeq ($(HAVE_GCC3_OPTIONS),yes)
  # very important to generate a return at the end of every operation
  OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
-@@ -166,6 +173,7 @@ endif
+@@ -182,6 +188,7 @@ OP_CFLAGS+=$(OS_CFLAGS)
  #########################################################
  
- DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-+DEFINES+= #-DDEBUG_GDB -DDEBUG -DDEBUG_KBD -DDEBUG_MOUSE
+ CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
++#CPPFLAGS+= -DDEBUG_GDB -DDEBUG -DDEBUG_KBD -DDEBUG_MOUSE
  LIBS+=-lm
  ifndef CONFIG_USER_ONLY
  LIBS+=-lz
-@@ -297,6 +305,9 @@ endif
+@@ -329,6 +336,9 @@ endif
  
  SOUND_HW = sb16.o es1370.o
  AUDIODRV = audio.o noaudio.o wavaudio.o
@@ -52,7 +41,7 @@
  ifdef CONFIG_SDL
  AUDIODRV += sdlaudio.o
  endif
-@@ -403,7 +414,7 @@ endif
+@@ -440,7 +450,7 @@ endif
  ifndef CONFIG_DARWIN
  ifndef CONFIG_WIN32
  ifndef CONFIG_SOLARIS
diff -urN --exclude=CVS qemu.orig/patches/patch-audio_ossaudio_c 
qemu/patches/patch-audio_ossaudio_c
--- qemu.orig/patches/patch-audio_ossaudio_c    Tue Dec 27 01:56:15 2005
+++ qemu/patches/patch-audio_ossaudio_c Mon Mar 12 15:56:24 2007
@@ -1,6 +1,6 @@
-$OpenBSD: patch-audio_ossaudio_c,v 1.2 2005/12/27 07:56:15 todd Exp $
---- audio/ossaudio.c.orig      Mon Dec 19 16:51:53 2005
-+++ audio/ossaudio.c   Tue Dec 20 11:00:04 2005
+$OpenBSD$
+--- audio/ossaudio.c.orig      Mon Feb  5 17:01:54 2007
++++ audio/ossaudio.c   Sat Mar 10 16:39:38 2007
 @@ -21,10 +21,15 @@
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   * THE SOFTWARE.
diff -urN --exclude=CVS qemu.orig/patches/patch-block-qcow2_c 
qemu/patches/patch-block-qcow2_c
--- qemu.orig/patches/patch-block-qcow2_c       Wed Dec 31 18:00:00 1969
+++ qemu/patches/patch-block-qcow2_c    Fri Apr  6 13:06:22 2007
@@ -0,0 +1,27 @@
+$OpenBSD$
+--- block-qcow2.c.orig Mon Feb  5 17:01:54 2007
++++ block-qcow2.c      Fri Apr  6 13:05:45 2007
+@@ -1884,6 +1884,8 @@ static int grow_refcount_table(BlockDriverState *bs, i
+     int new_table_size, new_table_size2, refcount_table_clusters, i, ret;
+     uint64_t *new_table;
+     int64_t table_offset;
++    int old_table_size;
++    int64_t old_table_offset;
+     uint64_t data64;
+     uint32_t data32;
+ 
+@@ -1931,10 +1933,14 @@ static int grow_refcount_table(BlockDriverState *bs, i
+                     &data32, sizeof(data32)) != sizeof(data32))
+         goto fail;
+     qemu_free(s->refcount_table);
++    old_table_offset = s->refcount_table_offset;
++    old_table_size = s->refcount_table_size;
+     s->refcount_table = new_table;
+     s->refcount_table_size = new_table_size;
++    s->refcount_table_offset = table_offset;
+ 
+     update_refcount(bs, table_offset, new_table_size2, 1);
++    free_clusters(bs, old_table_offset, old_table_size * sizeof(uint64_t));
+     return 0;
+  fail:
+     free_clusters(bs, table_offset, new_table_size2);
diff -urN --exclude=CVS qemu.orig/patches/patch-block-raw_c 
qemu/patches/patch-block-raw_c
--- qemu.orig/patches/patch-block-raw_c Wed Dec 31 18:00:00 1969
+++ qemu/patches/patch-block-raw_c      Tue Apr  3 08:35:36 2007
@@ -0,0 +1,141 @@
+$OpenBSD$
+--- block-raw.c.orig   Mon Feb  5 17:01:54 2007
++++ block-raw.c        Tue Apr  3 08:21:25 2007
+@@ -25,7 +25,9 @@
+ #include "block_int.h"
+ #include <assert.h>
+ #ifndef _WIN32
++#ifndef CONFIG_NO_AIO
+ #include <aio.h>
++#endif
+ 
+ #ifndef QEMU_TOOL
+ #include "exec-all.h"
+@@ -53,10 +55,16 @@
+ #include <linux/cdrom.h>
+ #include <linux/fd.h>
+ #endif
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__)
+ #include <sys/disk.h>
+ #endif
+ 
++#ifdef __OpenBSD__
++#include <sys/ioctl.h>
++#include <sys/disklabel.h>
++#include <sys/dkio.h>
++#endif
++
+ //#define DEBUG_FLOPPY
+ 
+ #define FTYPE_FILE   0
+@@ -158,6 +166,7 @@ static int raw_pwrite(BlockDriverState *bs, int64_t of
+ }
+ 
+ /***********************************************************/
++#ifndef CONFIG_NO_AIO
+ /* Unix AIO using POSIX AIO */
+ 
+ typedef struct RawAIOCB {
+@@ -380,6 +389,37 @@ static void raw_aio_cancel(BlockDriverAIOCB *blockacb)
+     }
+ }
+ 
++# else /* !CONFIG_NO_AIO */
++
++void qemu_aio_init(void)
++{
++}
++
++void qemu_aio_poll(void)
++{
++}
++
++void qemu_aio_flush(void)
++{
++}
++
++void qemu_aio_wait_start(void)
++{
++}
++
++void qemu_aio_wait(void)
++{
++#ifndef QEMU_TOOL
++      qemu_bh_poll();
++#endif
++}
++
++void qemu_aio_wait_end(void)
++{
++}
++
++#endif /* !CONFIG_NO_AIO */
++
+ static void raw_close(BlockDriverState *bs)
+ {
+     BDRVRawState *s = bs->opaque;
+@@ -399,8 +439,25 @@ static int raw_truncate(BlockDriverState *bs, int64_t 
+     return 0;
+ }
+ 
++#ifdef __OpenBSD__
+ static int64_t  raw_getlength(BlockDriverState *bs)
+ {
++      int fd = ((BDRVRawState*)bs->opaque)->fd;
++      struct stat st;
++      if(fstat(fd, &st))
++        return -1;
++      if(S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)){
++        struct disklabel dl;
++        if(ioctl(fd, DIOCGDINFO, &dl))
++          return -1;
++        return (uint64_t)dl.d_secsize *
++              dl.d_partitions[DISKPART(st.st_rdev)].p_size;
++      }else
++        return st.st_size;
++}
++#else /* !__OpenBSD__ */
++static int64_t  raw_getlength(BlockDriverState *bs)
++{
+     BDRVRawState *s = bs->opaque;
+     int fd = s->fd;
+     int64_t size;
+@@ -445,6 +502,7 @@ static int64_t  raw_getlength(BlockDriverState *bs)
+     }
+     return size;
+ }
++#endif
+ 
+ static int raw_create(const char *filename, int64_t total_size,
+                       const char *backing_file, int flags)
+@@ -479,11 +537,13 @@ BlockDriver bdrv_raw = {
+     raw_close,
+     raw_create,
+     raw_flush,
+-    
++
++#ifndef CONFIG_NO_AIO
+     .bdrv_aio_read = raw_aio_read,
+     .bdrv_aio_write = raw_aio_write,
+     .bdrv_aio_cancel = raw_aio_cancel,
+     .aiocb_size = sizeof(RawAIOCB),
++#endif /* !CONFIG_NO_AIO */
+     .protocol_name = "file",
+     .bdrv_pread = raw_pread,
+     .bdrv_pwrite = raw_pwrite,
+@@ -815,11 +875,13 @@ BlockDriver bdrv_host_device = {
+     raw_close,
+     NULL,
+     raw_flush,
+-    
++
++#ifndef CONFIG_NO_AIO
+     .bdrv_aio_read = raw_aio_read,
+     .bdrv_aio_write = raw_aio_write,
+     .bdrv_aio_cancel = raw_aio_cancel,
+     .aiocb_size = sizeof(RawAIOCB),
++#endif /* !CONFIG_NO_AIO */
+     .bdrv_pread = raw_pread,
+     .bdrv_pwrite = raw_pwrite,
+     .bdrv_getlength = raw_getlength,
diff -urN --exclude=CVS qemu.orig/patches/patch-configure 
qemu/patches/patch-configure
--- qemu.orig/patches/patch-configure   Wed Feb 21 07:18:51 2007
+++ qemu/patches/patch-configure        Tue Apr  3 08:35:36 2007
@@ -1,18 +1,20 @@
-$OpenBSD: patch-configure,v 1.7 2007/02/19 12:43:38 robert Exp $
---- configure.orig     Sat Jul 22 19:23:34 2006
-+++ configure  Tue Feb 13 09:22:48 2007
-@@ -21,8 +21,8 @@ prefix=""
+$OpenBSD$
+--- configure.orig     Mon Feb  5 17:01:54 2007
++++ configure  Tue Apr  3 08:21:26 2007
+@@ -21,10 +21,10 @@ prefix=""
  interp_prefix="/usr/gnemul/qemu-%M"
  static="no"
  cross_prefix=""
 -cc="gcc"
--host_cc="gcc"
 +cc="${CC:-cc}"
+ gcc3_search="yes"
+ gcc3_list="gcc-3.4 gcc34 gcc-3.3 gcc33 gcc-3.2 gcc32"
+-host_cc="gcc"
 +host_cc="${CC:-cc}"
  ar="ar"
  make="make"
  install="install"
-@@ -42,7 +42,7 @@ case "$cpu" in
+@@ -44,7 +44,7 @@ case "$cpu" in
    alpha)
      cpu="alpha"
    ;;
@@ -21,7 +23,7 @@
      cpu="powerpc"
    ;;
    mips)
-@@ -66,6 +66,9 @@ case "$cpu" in
+@@ -68,6 +68,9 @@ case "$cpu" in
    x86_64|amd64)
      cpu="x86_64"
    ;;
@@ -31,7 +33,7 @@
    *)
      cpu="unknown"
    ;;
-@@ -121,6 +124,7 @@ oss="yes"
+@@ -122,6 +125,7 @@ oss="yes"
  ;;
  OpenBSD)
  bsd="yes"
@@ -39,7 +41,7 @@
  oss="yes"
  ;;
  Darwin)
-@@ -509,7 +513,7 @@ else
+@@ -573,7 +577,7 @@ else
  if test -z "$prefix" ; then
      prefix="/usr/local"
  fi
@@ -48,7 +50,7 @@
  datadir="$prefix/share/qemu"
  docdir="$prefix/share/doc/qemu"
  bindir="$prefix/bin"
-@@ -537,9 +541,7 @@ if test "$darwin" = "yes" ; then
+@@ -601,9 +605,7 @@ if test "$darwin" = "yes" ; then
      echo "Cocoa support     $cocoa"
  fi
  echo "SDL support       $sdl"
@@ -59,7 +61,15 @@
  echo "mingw32 support   $mingw32"
  echo "Adlib support     $adlib"
  echo "CoreAudio support $coreaudio"
-@@ -602,6 +604,9 @@ if test "$cpu" = "i386" ; then
+@@ -648,6 +650,7 @@ echo "mandir=$mandir" >> $config_mak
+ echo "datadir=$datadir" >> $config_mak
+ echo "docdir=$docdir" >> $config_mak
+ echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
++echo "#define CONFIG_NO_AIO 1" >> $config_h
+ echo "MAKE=$make" >> $config_mak
+ echo "INSTALL=$install" >> $config_mak
+ echo "CC=$cc" >> $config_mak
+@@ -667,6 +670,9 @@ if test "$cpu" = "i386" ; then
  elif test "$cpu" = "x86_64" ; then
    echo "ARCH=x86_64" >> $config_mak
    echo "#define HOST_X86_64 1" >> $config_h
@@ -69,7 +79,7 @@
  elif test "$cpu" = "armv4b" ; then
    echo "ARCH=arm" >> $config_mak
    echo "#define HOST_ARM 1" >> $config_h
-@@ -681,6 +686,9 @@ fi
+@@ -746,6 +752,9 @@ fi
  if test "$oss" = "yes" ; then
    echo "CONFIG_OSS=yes" >> $config_mak
    echo "#define CONFIG_OSS 1" >> $config_h
@@ -79,9 +89,9 @@
  fi
  if test "$coreaudio" = "yes" ; then
    echo "CONFIG_COREAUDIO=yes" >> $config_mak
-@@ -715,6 +723,13 @@ fi
- if [ "$build_acpi_tables" = "yes" ] ; then
-   echo "BUILD_ACPI_TABLES=yes" >> $config_mak
+@@ -777,6 +786,13 @@ echo "TARGET_DIRS=$target_list" >> $config_mak
+ if [ "$build_docs" = "yes" ] ; then
+   echo "BUILD_DOCS=yes" >> $config_mak
  fi
 +
 +if [ "$openbsd" = "yes" ] ; then
diff -urN --exclude=CVS qemu.orig/patches/patch-cpu-all_h 
qemu/patches/patch-cpu-all_h
--- qemu.orig/patches/patch-cpu-all_h   Mon Feb 19 06:43:38 2007
+++ qemu/patches/patch-cpu-all_h        Tue Apr  3 08:35:37 2007
@@ -1,17 +1,21 @@
-$OpenBSD: patch-cpu-all_h,v 1.1 2007/02/19 12:43:38 robert Exp $
---- cpu-all.h.orig     Mon Feb 19 10:54:26 2007
-+++ cpu-all.h  Mon Feb 19 10:56:42 2007
-@@ -992,6 +992,24 @@ static inline int64_t cpu_get_real_ticks
-         return rval.i64;
+$OpenBSD$
+--- cpu-all.h.orig     Mon Feb  5 17:01:54 2007
++++ cpu-all.h  Tue Apr  3 08:21:26 2007
+@@ -1002,13 +1002,22 @@ static inline int64_t cpu_get_real_ticks (void)
  #endif
  }
-+#else
+ #else
+-/* The host CPU doesn't have an easily accessible cycle counter.
+-   Just return a monotonically increasing vlue.  This will be totally wrong,
+-   but hopefully better than nothing.  */
 +# warning non-optimized CPU
 +#include <sys/time.h>
 +#include <time.h>
 +
-+static inline int64_t cpu_get_real_ticks (void)
-+{
+ static inline int64_t cpu_get_real_ticks (void)
+ {
+-    static int64_t ticks = 0;
+-    return ticks++;
 +      struct timeval tv;
 +      static int64_t i = 0;
 +      int64_t j;
@@ -22,7 +26,6 @@
 +      } while (i == j);
 +      i = j;
 +      return j;
-+}
+ }
  #endif
  
- /* profiling */
diff -urN --exclude=CVS qemu.orig/patches/patch-cutils_c 
qemu/patches/patch-cutils_c
--- qemu.orig/patches/patch-cutils_c    Wed Dec 31 18:00:00 1969
+++ qemu/patches/patch-cutils_c Tue Apr  3 08:35:38 2007
@@ -0,0 +1,21 @@
+$OpenBSD$
+--- cutils.c.orig      Mon Feb  5 17:01:54 2007
++++ cutils.c   Tue Apr  3 08:21:27 2007
+@@ -23,7 +23,7 @@
+  */
+ #include "vl.h"
+ 
+-void pstrcpy(char *buf, int buf_size, const char *str)
++void pstrcpy(char *buf, size_t buf_size, const char *str)
+ {
+     int c;
+     char *q = buf;
+@@ -41,7 +41,7 @@ void pstrcpy(char *buf, int buf_size, const char *str)
+ }
+ 
+ /* strcat and truncate. */
+-char *pstrcat(char *buf, int buf_size, const char *s)
++char *pstrcat(char *buf, size_t buf_size, const char *s)
+ {
+     int len;
+     len = strlen(buf);
diff -urN --exclude=CVS qemu.orig/patches/patch-dis-asm_h 
qemu/patches/patch-dis-asm_h
--- qemu.orig/patches/patch-dis-asm_h   Mon Mar  7 10:41:28 2005
+++ qemu/patches/patch-dis-asm_h        Mon Mar 12 15:56:27 2007
@@ -1,6 +1,6 @@
-$OpenBSD: patch-dis-asm_h,v 1.1.1.1 2005/03/07 16:41:28 todd Exp $
---- dis-asm.h.orig     Mon Jan  3 17:35:10 2005
-+++ dis-asm.h  Sun Feb 27 15:47:13 2005
+$OpenBSD$
+--- dis-asm.h.orig     Mon Feb  5 17:01:54 2007
++++ dis-asm.h  Sat Mar 10 16:39:39 2007
 @@ -13,6 +13,7 @@
  #include <stdio.h>
  #include <string.h>
diff -urN --exclude=CVS qemu.orig/patches/patch-disas_c 
qemu/patches/patch-disas_c
--- qemu.orig/patches/patch-disas_c     Thu Jun  8 09:33:38 2006
+++ qemu/patches/patch-disas_c  Wed Dec 31 18:00:00 1969
@@ -1,12 +0,0 @@
-$OpenBSD: patch-disas_c,v 1.2 2006/06/08 14:33:38 todd Exp $
---- disas.c.orig       Wed May  3 15:32:58 2006
-+++ disas.c    Fri May  5 22:07:38 2006
-@@ -273,7 +273,7 @@ void disas(FILE *out, void *code, unsign
- #ifdef __arm__
-         /* since data are included in the code, it is better to
-            display code data too */
--        if (is_host) {
-+        if (1 /* is_host */) {
-             fprintf(out, "%08x  ", (int)bfd_getl32((const bfd_byte *)pc));
-         }
- #endif
diff -urN --exclude=CVS qemu.orig/patches/patch-dyngen-exec_h 
qemu/patches/patch-dyngen-exec_h
--- qemu.orig/patches/patch-dyngen-exec_h       Fri Dec 22 11:31:45 2006
+++ qemu/patches/patch-dyngen-exec_h    Mon Mar 12 15:56:27 2007
@@ -1,6 +1,6 @@
-$OpenBSD: patch-dyngen-exec_h,v 1.4 2006/12/22 17:31:45 todd Exp $
---- dyngen-exec.h.orig Sat Jul 22 13:23:34 2006
-+++ dyngen-exec.h      Sun Nov 12 17:10:10 2006
+$OpenBSD$
+--- dyngen-exec.h.orig Mon Feb  5 17:01:54 2007
++++ dyngen-exec.h      Sat Mar 10 16:39:39 2007
 @@ -27,11 +27,15 @@
  #define _FILEDEFED
  #endif
@@ -24,9 +24,9 @@
  #endif
 +#endif
  
- #define INT8_MIN              (-128)
- #define INT16_MIN             (-32767-1)
-@@ -75,11 +80,15 @@ typedef signed long long int64_t;
+ /* XXX: This may be wrong for 64-bit ILP32 hosts.  */
+ typedef void * host_reg_t;
+@@ -78,11 +83,15 @@ typedef void * host_reg_t;
  #define UINT32_MAX            (4294967295U)
  #define UINT64_MAX            ((uint64_t)(18446744073709551615))
  
diff -urN --exclude=CVS qemu.orig/patches/patch-exec_c qemu/patches/patch-exec_c
--- qemu.orig/patches/patch-exec_c      Fri Dec 22 11:31:45 2006
+++ qemu/patches/patch-exec_c   Tue Apr  3 08:35:40 2007
@@ -1,7 +1,7 @@
-$OpenBSD: patch-exec_c,v 1.5 2006/12/22 17:31:45 todd Exp $
---- exec.c.orig        Sat Jul 22 13:23:34 2006
-+++ exec.c     Sun Nov 12 17:10:10 2006
-@@ -2010,7 +2010,7 @@ void cpu_physical_memory_rw(target_phys_
+$OpenBSD$
+--- exec.c.orig        Mon Feb  5 17:01:54 2007
++++ exec.c     Tue Apr  3 08:21:30 2007
+@@ -2027,7 +2027,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, u
      target_phys_addr_t page;
      unsigned long pd;
      PhysPageDesc *p;
diff -urN --exclude=CVS qemu.orig/patches/patch-fpu_softfloat-native_c 
qemu/patches/patch-fpu_softfloat-native_c
--- qemu.orig/patches/patch-fpu_softfloat-native_c      Wed Aug 10 20:15:17 2005
+++ qemu/patches/patch-fpu_softfloat-native_c   Mon Mar 12 15:56:24 2007
@@ -1,6 +1,6 @@
-$OpenBSD: patch-fpu_softfloat-native_c,v 1.1 2005/08/11 01:15:17 todd Exp $
---- fpu/softfloat-native.c.orig        Wed Apr 27 13:53:34 2005
-+++ fpu/softfloat-native.c     Wed Apr 27 14:26:20 2005
+$OpenBSD$
+--- fpu/softfloat-native.c.orig        Mon Feb  5 17:01:54 2007
++++ fpu/softfloat-native.c     Sat Mar 10 16:39:39 2007
 @@ -1,6 +1,7 @@
  /* Native implementation of soft float functions. Only a single status
     context is supported */
diff -urN --exclude=CVS qemu.orig/patches/patch-fpu_softfloat-native_h 
qemu/patches/patch-fpu_softfloat-native_h
--- qemu.orig/patches/patch-fpu_softfloat-native_h      Thu Jun  8 09:33:38 2006
+++ qemu/patches/patch-fpu_softfloat-native_h   Mon Mar 12 15:56:24 2007
@@ -1,6 +1,6 @@
-$OpenBSD: patch-fpu_softfloat-native_h,v 1.2 2006/06/08 14:33:38 todd Exp $
---- fpu/softfloat-native.h.orig        Wed May  3 15:32:58 2006
-+++ fpu/softfloat-native.h     Fri May  5 22:11:59 2006
+$OpenBSD$
+--- fpu/softfloat-native.h.orig        Mon Feb  5 17:01:54 2007
++++ fpu/softfloat-native.h     Sat Mar 10 16:39:40 2007
 @@ -1,4 +1,5 @@
  /* Native implementation of soft float functions */
 +#include "gnu-c99-math.h"
diff -urN --exclude=CVS qemu.orig/patches/patch-gnu-c99-math_h 
qemu/patches/patch-gnu-c99-math_h
--- qemu.orig/patches/patch-gnu-c99-math_h      Thu Jun  8 09:33:38 2006
+++ qemu/patches/patch-gnu-c99-math_h   Mon Mar 12 15:56:28 2007
@@ -1,6 +1,6 @@
-$OpenBSD: patch-gnu-c99-math_h,v 1.3 2006/06/08 14:33:38 todd Exp $
---- gnu-c99-math.h.orig        Fri May  5 22:23:24 2006
-+++ gnu-c99-math.h     Thu May 11 20:24:00 2006
+$OpenBSD$
+--- gnu-c99-math.h.orig        Sat Mar 10 16:39:40 2007
++++ gnu-c99-math.h     Sat Mar 10 16:39:40 2007
 @@ -0,0 +1,23 @@
 +#if (defined(__sun__) || defined(__OpenBSD__)) && defined(__GNUC__)
 +
diff -urN --exclude=CVS qemu.orig/patches/patch-hw_ne2000_c 
qemu/patches/patch-hw_ne2000_c
--- qemu.orig/patches/patch-hw_ne2000_c Wed Dec 31 18:00:00 1969
+++ qemu/patches/patch-hw_ne2000_c      Thu Apr  5 17:26:56 2007
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- hw/ne2000.c.orig   Thu Apr  5 17:24:58 2007
++++ hw/ne2000.c        Thu Apr  5 17:25:11 2007
+@@ -206,7 +206,7 @@ static int ne2000_buffer_full(NE2000State *s)
+ 
+     index = s->curpag << 8;
+     boundary = s->boundary << 8;
+-    if (index <= boundary)
++    if (index < boundary)
+         avail = boundary - index;
+     else
+         avail = (s->stop - s->start) - (index - boundary);
diff -urN --exclude=CVS qemu.orig/patches/patch-hw_pc_c 
qemu/patches/patch-hw_pc_c
--- qemu.orig/patches/patch-hw_pc_c     Wed Dec 31 18:00:00 1969
+++ qemu/patches/patch-hw_pc_c  Fri Apr  6 13:13:03 2007
@@ -0,0 +1,47 @@
+$OpenBSD$
+--- hw/pc.c.orig       Mon Feb  5 17:01:54 2007
++++ hw/pc.c    Fri Apr  6 13:07:38 2007
+@@ -711,23 +711,36 @@ static void pc_init1(int ram_size, int vga_ram_size, i
+     if (i440fx_state) {
+         i440fx_init_memory_mappings(i440fx_state);
+     }
+-#if 0
+     /* ??? Need to figure out some way for the user to
+        specify SCSI devices.  */
+-    if (pci_enabled) {
++    if (pci_enabled && scsi_enabled) {
+         void *scsi;
+         BlockDriverState *bdrv;
+ 
+         scsi = lsi_scsi_init(pci_bus, -1);
+-        bdrv = bdrv_new("scsidisk");
+-        bdrv_open(bdrv, "scsi_disk.img", 0);
++        bdrv = bdrv_new("scsidisk0");
++        bdrv_open(bdrv, "scsi_disk0.img", 0);
+         lsi_scsi_attach(scsi, bdrv, -1);
+-        bdrv = bdrv_new("scsicd");
+-        bdrv_open(bdrv, "scsi_cd.iso", 0);
++        bdrv = bdrv_new("scsidisk1");
++        bdrv_open(bdrv, "scsi_disk1.img", 0);
++        lsi_scsi_attach(scsi, bdrv, -1);
++        bdrv = bdrv_new("scsidisk2");
++        bdrv_open(bdrv, "scsi_disk2.img", 0);
++        lsi_scsi_attach(scsi, bdrv, -1);
++        bdrv = bdrv_new("scsidisk3");
++        bdrv_open(bdrv, "scsi_disk3.img", 0);
++        lsi_scsi_attach(scsi, bdrv, -1);
++        bdrv = bdrv_new("scsidisk4");
++        bdrv_open(bdrv, "scsi_disk4.img", 0);
++        lsi_scsi_attach(scsi, bdrv, -1);
++        bdrv = bdrv_new("scsidisk5");
++        bdrv_open(bdrv, "scsi_disk5.img", 0);
++        lsi_scsi_attach(scsi, bdrv, -1);
++        bdrv = bdrv_new("scsicd0");
++        bdrv_open(bdrv, "scsi_cd0.iso", 0);
+         bdrv_set_type_hint(bdrv, BDRV_TYPE_CDROM);
+         lsi_scsi_attach(scsi, bdrv, -1);
+     }
+-#endif
+ }
+ 
+ static void pc_init_pci(int ram_size, int vga_ram_size, int boot_device,
diff -urN --exclude=CVS qemu.orig/patches/patch-osdep_h 
qemu/patches/patch-osdep_h
--- qemu.orig/patches/patch-osdep_h     Fri Dec 22 11:31:45 2006
+++ qemu/patches/patch-osdep_h  Mon Mar 12 15:56:29 2007
@@ -1,6 +1,6 @@
-$OpenBSD: patch-osdep_h,v 1.2 2006/12/22 17:31:45 todd Exp $
---- osdep.h.orig       Sat Jul 22 13:23:34 2006
-+++ osdep.h    Sun Nov 12 17:10:10 2006
+$OpenBSD$
+--- osdep.h.orig       Mon Feb  5 17:01:54 2007
++++ osdep.h    Sat Mar 10 16:39:40 2007
 @@ -2,6 +2,10 @@
  #define QEMU_OSDEP_H
  
@@ -10,14 +10,5 @@
 +#include <sys/signal.h>
 +#endif
  
- int qemu_vsnprintf(char *buf, int buflen, const char *fmt, va_list args);
- void qemu_vprintf(const char *fmt, va_list ap);
-@@ -33,7 +37,7 @@ struct siginfo;
- struct qemu_sigaction {
-     union {
-         void (*_sa_handler)(int);
--        void (*_sa_sigaction)(int, struct siginfo *, void *);
-+        void (*_sa_sigaction)(int, qemu_siginfo *, void *);
-     } _u;
-     unsigned long sa_flags;
-     void (*sa_restorer)(void);
+ #define qemu_printf printf
+ 
diff -urN --exclude=CVS qemu.orig/patches/patch-qemu-img_c 
qemu/patches/patch-qemu-img_c
--- qemu.orig/patches/patch-qemu-img_c  Fri Dec 22 11:31:45 2006
+++ qemu/patches/patch-qemu-img_c       Wed Dec 31 18:00:00 1969
@@ -1,21 +0,0 @@
-$OpenBSD: patch-qemu-img_c,v 1.2 2006/12/22 17:31:45 todd Exp $
---- qemu-img.c.orig    Sat Jul 22 13:23:34 2006
-+++ qemu-img.c Sun Nov 12 17:10:10 2006
-@@ -62,7 +62,7 @@ char *qemu_strdup(const char *str)
-     return ptr;
- }
- 
--void pstrcpy(char *buf, int buf_size, const char *str)
-+void pstrcpy(char *buf, size_t buf_size, const char *str)
- {
-     int c;
-     char *q = buf;
-@@ -80,7 +80,7 @@ void pstrcpy(char *buf, int buf_size, co
- }
- 
- /* strcat and truncate. */
--char *pstrcat(char *buf, int buf_size, const char *s)
-+char *pstrcat(char *buf, size_t buf_size, const char *s)
- {
-     int len;
-     len = strlen(buf);
diff -urN --exclude=CVS qemu.orig/patches/patch-slirp_slirp_config_h 
qemu/patches/patch-slirp_slirp_config_h
--- qemu.orig/patches/patch-slirp_slirp_config_h        Thu Jun  8 09:33:38 2006
+++ qemu/patches/patch-slirp_slirp_config_h     Mon Mar 12 15:56:25 2007
@@ -1,6 +1,6 @@
-$OpenBSD: patch-slirp_slirp_config_h,v 1.3 2006/06/08 14:33:38 todd Exp $
---- slirp/slirp_config.h.orig  Wed May  3 15:32:58 2006
-+++ slirp/slirp_config.h       Fri May  5 22:07:41 2006
+$OpenBSD$
+--- slirp/slirp_config.h.orig  Mon Feb  5 17:01:54 2007
++++ slirp/slirp_config.h       Sat Mar 10 16:39:40 2007
 @@ -92,7 +92,7 @@
  #undef BAD_SPRINTF
  
diff -urN --exclude=CVS qemu.orig/patches/patch-target-arm_cpu_h 
qemu/patches/patch-target-arm_cpu_h
--- qemu.orig/patches/patch-target-arm_cpu_h    Thu Jun  8 09:33:38 2006
+++ qemu/patches/patch-target-arm_cpu_h Wed Dec 31 18:00:00 1969
@@ -1,12 +0,0 @@
-$OpenBSD: patch-target-arm_cpu_h,v 1.4 2006/06/08 14:33:38 todd Exp $
---- target-arm/cpu.h.orig      Wed May  3 15:32:58 2006
-+++ target-arm/cpu.h   Fri May  5 22:07:41 2006
-@@ -132,7 +132,7 @@ void switch_mode(CPUARMState *, int);
-    signal handlers to inform the virtual CPU of exceptions. non zero
-    is returned if the signal was handled by the virtual CPU.  */
- struct siginfo;
--int cpu_arm_signal_handler(int host_signum, struct siginfo *info, 
-+int cpu_arm_signal_handler(int host_signum, qemu_siginfo *info, 
-                            void *puc);
- 
- #define CPSR_M (0x1f)
diff -urN --exclude=CVS qemu.orig/patches/patch-target-i386_cpu_h 
qemu/patches/patch-target-i386_cpu_h
--- qemu.orig/patches/patch-target-i386_cpu_h   Thu Jun  8 09:33:38 2006
+++ qemu/patches/patch-target-i386_cpu_h        Wed Dec 31 18:00:00 1969
@@ -1,13 +0,0 @@
-$OpenBSD: patch-target-i386_cpu_h,v 1.4 2006/06/08 14:33:38 todd Exp $
---- target-i386/cpu.h.orig     Wed May  3 15:32:58 2006
-+++ target-i386/cpu.h  Fri May  5 22:07:41 2006
-@@ -617,8 +617,7 @@ void cpu_x86_frstor(CPUX86State *s, uint
- /* 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.  */
--struct siginfo;
--int cpu_x86_signal_handler(int host_signum, struct siginfo *info, 
-+int cpu_x86_signal_handler(int host_signum, qemu_siginfo *info, 
-                            void *puc);
- void cpu_x86_set_a20(CPUX86State *env, int a20_state);
- 
diff -urN --exclude=CVS qemu.orig/patches/patch-target-i386_helper2_c 
qemu/patches/patch-target-i386_helper2_c
--- qemu.orig/patches/patch-target-i386_helper2_c       Fri Dec 22 11:31:45 2006
+++ qemu/patches/patch-target-i386_helper2_c    Mon Mar 12 15:56:25 2007
@@ -1,6 +1,6 @@
-$OpenBSD: patch-target-i386_helper2_c,v 1.4 2006/12/22 17:31:45 todd Exp $
---- target-i386/helper2.c.orig Sat Jul 22 13:23:34 2006
-+++ target-i386/helper2.c      Sun Nov 12 17:10:10 2006
+$OpenBSD$
+--- target-i386/helper2.c.orig Mon Feb  5 17:01:54 2007
++++ target-i386/helper2.c      Mon Mar 12 15:48:39 2007
 @@ -127,7 +127,7 @@ CPUX86State *cpu_x86_init(void)
                  env->cpuid_model[i >> 2] |= c << (8 * (i & 3));
              }
@@ -10,12 +10,12 @@
          /* currently not enabled for std i386 because not fully tested */
          env->cpuid_ext2_features = (env->cpuid_features & 0x0183F3FF);
          env->cpuid_ext2_features |= CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | 
CPUID_EXT2_NX;
-@@ -135,7 +135,7 @@ CPUX86State *cpu_x86_init(void)
- 
-         /* these features are needed for Win64 and aren't fully implemented */
+@@ -137,7 +137,7 @@ CPUX86State *cpu_x86_init(void)
          env->cpuid_features |= CPUID_MTRR | CPUID_CLFLUSH | CPUID_MCA;
+         /* this feature is needed for Solaris and isn't fully implemented */
+         env->cpuid_features |= CPUID_PSE36;
 -#endif
-+/* #endif -- To run Mac OS X x86  */
++/* #endif -- To run Mac OS X x86 */
      }
      cpu_reset(env);
  #ifdef USE_KQEMU
diff -urN --exclude=CVS qemu.orig/patches/patch-target-ppc_cpu_h 
qemu/patches/patch-target-ppc_cpu_h
--- qemu.orig/patches/patch-target-ppc_cpu_h    Tue Dec 27 01:56:15 2005
+++ qemu/patches/patch-target-ppc_cpu_h Wed Dec 31 18:00:00 1969
@@ -1,13 +0,0 @@
-$OpenBSD: patch-target-ppc_cpu_h,v 1.3 2005/12/27 07:56:15 todd Exp $
---- target-ppc/cpu.h.orig      Mon Dec 19 16:51:53 2005
-+++ target-ppc/cpu.h   Tue Dec 20 08:06:20 2005
-@@ -573,8 +573,7 @@ void cpu_ppc_close(CPUPPCState *s);
- /* 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.  */
--struct siginfo;
--int cpu_ppc_signal_handler(int host_signum, struct siginfo *info, 
-+int cpu_ppc_signal_handler(int host_signum, qemu_siginfo *info, 
-                            void *puc);
- 
- void do_interrupt (CPUPPCState *env);
diff -urN --exclude=CVS qemu.orig/patches/patch-target-ppc_op_helper_c 
qemu/patches/patch-target-ppc_op_helper_c
--- qemu.orig/patches/patch-target-ppc_op_helper_c      Thu Jun  8 09:33:38 2006
+++ qemu/patches/patch-target-ppc_op_helper_c   Mon Mar 12 15:56:25 2007
@@ -1,6 +1,6 @@
-$OpenBSD: patch-target-ppc_op_helper_c,v 1.3 2006/06/08 14:33:38 todd Exp $
---- target-ppc/op_helper.c.orig        Fri May  5 22:29:25 2006
-+++ target-ppc/op_helper.c     Fri May  5 22:29:34 2006
+$OpenBSD$
+--- target-ppc/op_helper.c.orig        Mon Feb  5 17:01:54 2007
++++ target-ppc/op_helper.c     Sat Mar 10 16:39:41 2007
 @@ -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
diff -urN --exclude=CVS qemu.orig/patches/patch-target-sparc_cpu_h 
qemu/patches/patch-target-sparc_cpu_h
--- qemu.orig/patches/patch-target-sparc_cpu_h  Tue Dec 27 01:56:15 2005
+++ qemu/patches/patch-target-sparc_cpu_h       Wed Dec 31 18:00:00 1969
@@ -1,16 +0,0 @@
-$OpenBSD: patch-target-sparc_cpu_h,v 1.3 2005/12/27 07:56:15 todd Exp $
---- target-sparc/cpu.h.orig    Mon Dec 19 16:51:53 2005
-+++ target-sparc/cpu.h Tue Dec 20 08:06:20 2005
-@@ -269,8 +269,12 @@ void cpu_set_cwp(CPUSPARCState *env1, in
-     } while (0)
- #endif
- 
-+#ifdef _BSD
-+int cpu_sparc_signal_handler(int hostsignum, qemu_siginfo *info, void *puc);
-+#else
- struct siginfo;
- int cpu_sparc_signal_handler(int hostsignum, struct siginfo *info, void *puc);
-+#endif
- 
- #include "cpu-all.h"
- 
diff -urN --exclude=CVS qemu.orig/patches/patch-target-sparc_op_helper_c 
qemu/patches/patch-target-sparc_op_helper_c
--- qemu.orig/patches/patch-target-sparc_op_helper_c    Mon Feb 19 16:59:33 2007
+++ qemu/patches/patch-target-sparc_op_helper_c Wed Dec 31 18:00:00 1969
@@ -1,18 +0,0 @@
-$OpenBSD: patch-target-sparc_op_helper_c,v 1.3 2007/02/19 22:59:33 kili Exp $
---- target-sparc/op_helper.c.orig      Fri Jan  5 18:29:09 2007
-+++ target-sparc/op_helper.c   Fri Jan  5 18:29:28 2007
-@@ -12,12 +12,12 @@ void raise_exception(int tt)
- #ifdef USE_INT_TO_FLOAT_HELPERS
- void do_fitos(void)
- {
--    FT0 = int32_to_float32(*((int32_t *)&FT1));
-+    FT0 = int32_to_float32(*((int32_t *)&FT1), &env->fp_status);
- }
- 
- void do_fitod(void)
- {
--    DT0 = int32_to_float64(*((int32_t *)&FT1));
-+    DT0 = int32_to_float64(*((int32_t *)&FT1), &env->fp_status);
- }
- #endif
- 
diff -urN --exclude=CVS qemu.orig/patches/patch-vl_c qemu/patches/patch-vl_c
--- qemu.orig/patches/patch-vl_c        Wed Feb 21 07:18:52 2007
+++ qemu/patches/patch-vl_c     Sat Apr 21 20:04:35 2007
@@ -1,6 +1,7 @@
---- vl.c.orig  Sat Jul 22 19:23:34 2006
-+++ vl.c       Mon Feb 19 11:30:23 2007
-@@ -43,7 +43,8 @@
+$OpenBSD$
+--- vl.c.orig  Mon Feb  5 17:01:54 2007
++++ vl.c       Sat Apr 21 19:48:30 2007
+@@ -44,7 +44,8 @@
  #include <netdb.h>
  #ifdef _BSD
  #include <sys/stat.h>
@@ -10,37 +11,15 @@
  #include <libutil.h>
  #endif
  #else
-@@ -291,7 +292,7 @@ void isa_unassign_ioport(int start, int 
- 
- /***********************************************************/
- 
--void pstrcpy(char *buf, int buf_size, const char *str)
-+void pstrcpy(char *buf, size_t buf_size, const char *str)
- {
-     int c;
-     char *q = buf;
-@@ -309,7 +310,7 @@ void pstrcpy(char *buf, int buf_size, co
- }
- 
- /* strcat and truncate. */
--char *pstrcat(char *buf, int buf_size, const char *s)
-+char *pstrcat(char *buf, size_t buf_size, const char *s)
- {
-     int len;
-     len = strlen(buf);
-@@ -1408,6 +1409,11 @@ static void stdio_read(void *opaque)
-     uint8_t buf[1];
-     
-     size = read(0, buf, 1);
-+    if (size == 0) {
-+        /* stdin has been closed. Remove it from the active list.  */
-+        qemu_set_fd_handler2(0, NULL, NULL, NULL, NULL);
-+        return;
-+    }
-     if (size > 0)
-         stdio_received_byte(buf[0]);
- }
-@@ -2631,7 +2637,7 @@ static int parse_macaddr(uint8_t *macadd
+@@ -168,6 +169,7 @@ const char *vnc_display;
+ int acpi_enabled = 1;
+ int fd_bootchk = 1;
+ int no_reboot = 0;
++int scsi_enabled = 0;
+ int daemonize = 0;
+ const char *option_rom[MAX_OPTION_ROMS];
+ int nb_option_roms;
+@@ -2808,7 +2810,7 @@ static int parse_macaddr(uint8_t *macaddr, const char 
      return 0;
  }
  
@@ -49,7 +28,7 @@
  {
      const char *p, *p1;
      int len;
-@@ -3029,11 +3035,85 @@ static int tap_open(char *ifname, int if
+@@ -3226,11 +3228,85 @@ static int tap_open(char *ifname, int ifname_size)
      char *dev;
      struct stat s;
  
@@ -135,7 +114,15 @@
  
      fstat(fd, &s);
      dev = devname(s.st_rdev, S_IFCHR);
-@@ -3279,7 +3359,7 @@ static int net_socket_mcast_create(struc
+@@ -3282,6 +3358,7 @@ static int net_tap_init(VLANState *vlan, const char *i
+     char *args[3];
+     char **parg;
+     char ifname[128];
++    bzero(&ifname,sizeof(ifname));
+ 
+     if (ifname1 != NULL)
+         pstrcpy(ifname, sizeof(ifname), ifname1);
+@@ -3476,7 +3553,7 @@ static int net_socket_mcast_create(struct sockaddr_in 
      /* Force mcast msgs to loopback (eg. several QEMUs in same host */
      val = 1;
      ret=setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, 
@@ -144,7 +131,7 @@
      if (ret < 0) {
        perror("setsockopt(SOL_IP, IP_MULTICAST_LOOP)");
        goto fail;
-@@ -3535,7 +3615,8 @@ static int net_socket_mcast_init(VLANSta
+@@ -3732,7 +3809,8 @@ static int net_socket_mcast_init(VLANState *vlan, cons
  
  }
  
@@ -154,31 +141,81 @@
                             const char *tag, const char *str)
  {
      const char *p;
-@@ -3660,17 +3741,21 @@ int net_client_init(const char *str)
+@@ -3856,6 +3934,8 @@ static int net_client_init(const char *str)
+     if (!strcmp(device, "tap")) {
          char ifname[64];
          char setup_script[1024];
++      bzero(&ifname,sizeof(ifname));
++      bzero(&setup_script,sizeof(setup_script));
          int fd;
-+        bzero(&ifname,sizeof(ifname));
-+        bzero(&setup_script,sizeof(setup_script));
          if (get_param_value(buf, sizeof(buf), "fd", p) > 0) {
              fd = strtol(buf, NULL, 0);
-             ret = -1;
+@@ -3863,13 +3943,13 @@ static int net_client_init(const char *str)
              if (net_tap_fd_init(vlan, fd))
                  ret = 0;
          } else {
--            get_param_value(ifname, sizeof(ifname), "ifname", p);
+-            if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) {
+-                ifname[0] = '\0';
+-            }
              if (get_param_value(setup_script, sizeof(setup_script), "script", 
p) == 0) {
                  pstrcpy(setup_script, sizeof(setup_script), 
DEFAULT_NETWORK_SCRIPT);
              }
 -            ret = net_tap_init(vlan, ifname, setup_script);
 +            if (get_param_value(ifname, sizeof(ifname), "ifname", p) == 0)
-+               ret = net_tap_init(vlan, NULL, setup_script);
-+            else
-+               ret = net_tap_init(vlan, ifname, setup_script);
++              ret = net_tap_init(vlan, NULL, setup_script);
++          else
++              ret = net_tap_init(vlan, NULL, setup_script);
          }
      } else
  #endif
-@@ -5671,7 +5756,7 @@ int main(int argc, char **argv)
+@@ -6117,6 +6197,7 @@ void help(void)
+            "-no-acpi        disable ACPI\n"
+ #endif
+            "-no-reboot      exit instead of rebooting\n"
++           "-scsienable     enable scsi devices\n"
+            "-loadvm file    start right away with a saved state (loadvm in 
monitor)\n"
+          "-vnc display    start a VNC server on display\n"
+ #ifndef _WIN32
+@@ -6205,7 +6286,8 @@ enum {
+     QEMU_OPTION_no_reboot,
+     QEMU_OPTION_daemonize,
+     QEMU_OPTION_option_rom,
+-    QEMU_OPTION_semihosting
++    QEMU_OPTION_semihosting,
++    QEMU_OPTION_scsi
+ };
+ 
+ typedef struct QEMUOption {
+@@ -6281,6 +6363,7 @@ const QEMUOption qemu_options[] = {
+     { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
+     { "smp", HAS_ARG, QEMU_OPTION_smp },
+     { "vnc", HAS_ARG, QEMU_OPTION_vnc },
++    { "scsienable", 0, QEMU_OPTION_scsi },
+ 
+     /* temporary options */
+     { "usb", 0, QEMU_OPTION_usb },
+@@ -6570,7 +6653,11 @@ int main(int argc, char **argv)
+     gdbstub_port = DEFAULT_GDBSTUB_PORT;
+ #endif
+     snapshot = 0;
++#if defined(CONFIG_SDL) || defined(CONFIG_COCOA)
+     nographic = 0;
++#else
++    nographic = 1;
++#endif
+     kernel_filename = NULL;
+     kernel_cmdline = "";
+ #ifdef TARGET_PPC
+@@ -6580,14 +6667,14 @@ int main(int argc, char **argv)
+ #endif
+     cyls = heads = secs = 0;
+     translation = BIOS_ATA_TRANSLATION_AUTO;
+-    pstrcpy(monitor_device, sizeof(monitor_device), "vc");
++    pstrcpy(monitor_device, sizeof(monitor_device), nographic ? "stdio" : 
"vc" );
+ 
+-    pstrcpy(serial_devices[0], sizeof(serial_devices[0]), "vc");
++    pstrcpy(serial_devices[0], sizeof(serial_devices[0]), nographic ? "stdio" 
: "vc");
+     for(i = 1; i < MAX_SERIAL_PORTS; i++)
          serial_devices[i][0] = '\0';
      serial_device_index = 0;
      
@@ -187,3 +224,13 @@
      for(i = 1; i < MAX_PARALLEL_PORTS; i++)
          parallel_devices[i][0] = '\0';
      parallel_device_index = 0;
+@@ -6940,6 +7027,9 @@ int main(int argc, char **argv)
+               break;
+             case QEMU_OPTION_no_acpi:
+                 acpi_enabled = 0;
++                break;
++            case QEMU_OPTION_scsi:
++                scsi_enabled = 1;
+                 break;
+             case QEMU_OPTION_no_reboot:
+                 no_reboot = 1;
diff -urN --exclude=CVS qemu.orig/patches/patch-vl_h qemu/patches/patch-vl_h
--- qemu.orig/patches/patch-vl_h        Fri Dec 22 11:31:45 2006
+++ qemu/patches/patch-vl_h     Fri Apr  6 13:19:35 2007
@@ -1,14 +1,22 @@
-$OpenBSD: patch-vl_h,v 1.6 2006/12/22 17:31:45 todd Exp $
---- vl.h.orig  Sat Jul 22 13:23:34 2006
-+++ vl.h       Sun Nov 12 17:10:10 2006
-@@ -104,8 +104,8 @@ void hw_error(const char *fmt, ...);
+$OpenBSD$
+--- vl.h.orig  Mon Feb  5 17:01:54 2007
++++ vl.h       Fri Apr  6 13:18:16 2007
+@@ -101,8 +101,8 @@ static inline char *realpath(const char *path, char *r
+ #endif
  
- extern const char *bios_dir;
- 
+ /* cutils.c */
 -void pstrcpy(char *buf, int buf_size, const char *str);
 -char *pstrcat(char *buf, int buf_size, const char *s);
 +void pstrcpy(char *buf, size_t buf_size, const char *str);
 +char *pstrcat(char *buf, size_t buf_size, const char *s);
  int strstart(const char *str, const char *val, const char **ptr);
+ int stristart(const char *str, const char *val, const char **ptr);
  
+@@ -114,6 +114,7 @@ void hw_error(const char *fmt, ...);
+ extern const char *bios_dir;
+ 
  extern int vm_running;
++extern int scsi_enabled;
+ 
+ typedef struct vm_change_state_entry VMChangeStateEntry;
+ typedef void VMChangeStateHandler(void *opaque, int running);
diff -urN --exclude=CVS qemu.orig/patches/patch-x_keymap_c 
qemu/patches/patch-x_keymap_c
--- qemu.orig/patches/patch-x_keymap_c  Wed Aug 10 20:15:17 2005
+++ qemu/patches/patch-x_keymap_c       Wed Dec 31 18:00:00 1969
@@ -1,101 +0,0 @@
-$OpenBSD: patch-x_keymap_c,v 1.1 2005/08/11 01:15:17 todd Exp $
---- x_keymap.c.orig    Mon Apr 25 08:36:00 2005
-+++ x_keymap.c Mon Apr 25 08:36:00 2005
-@@ -0,0 +1,97 @@
-+/*
-+ * QEMU SDL display driver
-+ * 
-+ * Copyright (c) 2003 Fabrice Bellard
-+ * 
-+ * Permission is hereby granted, free of charge, to any person obtaining a 
copy
-+ * of this software and associated documentation files (the "Software"), to 
deal
-+ * in the Software without restriction, including without limitation the 
rights
-+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-+ * copies of the Software, and to permit persons to whom the Software is
-+ * furnished to do so, subject to the following conditions:
-+ *
-+ * The above copyright notice and this permission notice shall be included in
-+ * all copies or substantial portions of the Software.
-+ *
-+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
-+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-+ * THE SOFTWARE.
-+ */
-+
-+static const uint8_t x_keycode_to_pc_keycode[61] = {
-+   0xc7,      /*  97  Home   */
-+   0xc8,      /*  98  Up     */
-+   0xc9,      /*  99  PgUp   */
-+   0xcb,      /* 100  Left   */
-+   0x4c,        /* 101  KP-5   */
-+   0xcd,      /* 102  Right  */
-+   0xcf,      /* 103  End    */
-+   0xd0,      /* 104  Down   */
-+   0xd1,      /* 105  PgDn   */
-+   0xd2,      /* 106  Ins    */
-+   0xd3,      /* 107  Del    */
-+   0x9c,      /* 108  Enter  */
-+   0x9d,      /* 109  Ctrl-R */
-+   0x0,       /* 110  Pause  */
-+   0xb7,      /* 111  Print  */
-+   0xb5,      /* 112  Divide */
-+   0xb8,      /* 113  Alt-R  */
-+   0xc6,      /* 114  Break  */
-+   0x0,         /* 115 */
-+   0x0,         /* 116 */
-+   0x0,         /* 117 */
-+   0x0,         /* 118 */
-+   0x0,         /* 119 */
-+   0x70,         /* 120 Hiragana_Katakana */
-+   0x0,         /* 121 */
-+   0x0,         /* 122 */
-+   0x73,         /* 123 backslash */
-+   0x0,         /* 124 */
-+   0x0,         /* 125 */
-+   0x0,         /* 126 */
-+   0x0,         /* 127 */
-+   0x0,         /* 128 */
-+   0x79,         /* 129 Henkan */
-+   0x0,         /* 130 */
-+   0x7b,         /* 131 Muhenkan */
-+   0x0,         /* 132 */
-+   0x7d,         /* 133 Yen */
-+   0x0,         /* 134 */
-+   0x0,         /* 135 */
-+   0x47,         /* 136 KP_7 */
-+   0x48,         /* 137 KP_8 */
-+   0x49,         /* 138 KP_9 */
-+   0x4b,         /* 139 KP_4 */
-+   0x4c,         /* 140 KP_5 */
-+   0x4d,         /* 141 KP_6 */
-+   0x4f,         /* 142 KP_1 */
-+   0x50,         /* 143 KP_2 */
-+   0x51,         /* 144 KP_3 */
-+   0x52,         /* 145 KP_0 */
-+   0x53,         /* 146 KP_. */
-+   0x47,         /* 147 KP_HOME */
-+   0x48,         /* 148 KP_UP */
-+   0x49,         /* 149 KP_PgUp */
-+   0x4b,         /* 150 KP_Left */
-+   0x4c,         /* 151 KP_ */
-+   0x4d,         /* 152 KP_Right */
-+   0x4f,         /* 153 KP_End */
-+   0x50,         /* 154 KP_Down */
-+   0x51,         /* 155 KP_PgDn */
-+   0x52,         /* 156 KP_Ins */
-+   0x53,         /* 157 KP_Del */
-+};
-+
-+static uint8_t _native_scancode(const int key)
-+{
-+#if defined(_WIN32) && 0
-+      return key;
-+#else
-+      return x_keycode_to_pc_keycode[key];
-+#endif
-+}
-+
diff -urN --exclude=CVS qemu.orig/pkg/PLIST qemu/pkg/PLIST
--- qemu.orig/pkg/PLIST Fri Dec 22 11:31:45 2006
+++ qemu/pkg/PLIST      Tue Mar 20 20:52:47 2007
@@ -58,6 +58,9 @@
 share/qemu/linux_boot.bin
 share/qemu/openbios-sparc32
 share/qemu/ppc_rom.bin
+share/qemu/pxe-ne2k_pci.bin
+share/qemu/pxe-pcnet.bin
+share/qemu/pxe-rtl8139.bin
 share/qemu/vgabios-cirrus.bin
 share/qemu/vgabios.bin
 share/qemu/video.x

Reply via email to