From 4e159a33aafc826719cd62ddecf4c4861f307c1b Mon Sep 17 00:00:00 2001 From: todd Date: Thu, 8 Jun 2006 14:33:38 +0000 Subject: [PATCH] update to 0.8.1, see http://qemu.org/changelog.html for details --- emulators/qemu/Makefile | 5 +- emulators/qemu/distinfo | 8 +- emulators/qemu/files/qemu-ifup | 2 +- emulators/qemu/patches/patch-Makefile | 68 ++- emulators/qemu/patches/patch-Makefile_target | 26 +- emulators/qemu/patches/patch-configure | 26 +- emulators/qemu/patches/patch-disas_c | 8 +- emulators/qemu/patches/patch-dyngen-exec_h | 16 +- emulators/qemu/patches/patch-exec_c | 8 +- .../qemu/patches/patch-fpu_softfloat-native_h | 16 +- emulators/qemu/patches/patch-gnu-c99-math_h | 9 +- emulators/qemu/patches/patch-hw_lance_c | 24 - emulators/qemu/patches/patch-hw_ne2000_c | 73 +--- emulators/qemu/patches/patch-hw_pc_c | 34 +- emulators/qemu/patches/patch-hw_rtl8139_c | 413 ++++++++++++++++++ emulators/qemu/patches/patch-hw_smc91c111_c | 30 -- .../qemu/patches/patch-slirp_slirp_config_h | 8 +- emulators/qemu/patches/patch-target-arm_cpu_h | 8 +- .../qemu/patches/patch-target-i386_cpu_h | 8 +- .../qemu/patches/patch-target-i386_helper2_c | 10 +- .../qemu/patches/patch-target-ppc_op_helper_c | 12 +- emulators/qemu/patches/patch-vl_c | 122 +----- emulators/qemu/patches/patch-vl_h | 38 +- emulators/qemu/patches/patch-vnc_c | 294 +++++++++++++ emulators/qemu/patches/patch-vnchextile_h | 92 ++++ emulators/qemu/pkg/PLIST | 3 +- 26 files changed, 979 insertions(+), 382 deletions(-) delete mode 100644 emulators/qemu/patches/patch-hw_lance_c create mode 100644 emulators/qemu/patches/patch-hw_rtl8139_c delete mode 100644 emulators/qemu/patches/patch-hw_smc91c111_c create mode 100644 emulators/qemu/patches/patch-vnc_c create mode 100644 emulators/qemu/patches/patch-vnchextile_h diff --git a/emulators/qemu/Makefile b/emulators/qemu/Makefile index ac89acae043..8c03b0bab0f 100644 --- a/emulators/qemu/Makefile +++ b/emulators/qemu/Makefile @@ -1,11 +1,10 @@ -# $OpenBSD: Makefile,v 1.14 2006/04/10 21:10:05 todd Exp $ +# $OpenBSD: Makefile,v 1.15 2006/06/08 14:33:38 todd Exp $ # no success building on other archs yet ONLY_FOR_ARCHS= amd64 arm i386 powerpc COMMENT= "multi system emulator" -DISTNAME= qemu-0.8.0 -PKGNAME= ${DISTNAME}p4 +DISTNAME= qemu-0.8.1 CATEGORIES= emulators HOMEPAGE= http://fabrice.bellard.free.fr/qemu/ diff --git a/emulators/qemu/distinfo b/emulators/qemu/distinfo index 2bb4d233697..6d6e06bd246 100644 --- a/emulators/qemu/distinfo +++ b/emulators/qemu/distinfo @@ -1,4 +1,4 @@ -MD5 (qemu-0.8.0.tar.gz) = eb175b26583280706fe7e4d8910d320d -RMD160 (qemu-0.8.0.tar.gz) = 3fc6da938f75364d0805ca0ecf8cb84a4b546dc7 -SHA1 (qemu-0.8.0.tar.gz) = f7bcf2f0eee9e5207cba265f3c47ae781244628e -SIZE (qemu-0.8.0.tar.gz) = 1497965 +MD5 (qemu-0.8.1.tar.gz) = 67d924324a5ab79d017bd97a1e767285 +RMD160 (qemu-0.8.1.tar.gz) = 04d163d4792bbea39fc0b1e52af124cdb7e907dc +SHA1 (qemu-0.8.1.tar.gz) = 72c943c24bed6aa066dcc3012b198c20f04aef30 +SIZE (qemu-0.8.1.tar.gz) = 1623264 diff --git a/emulators/qemu/files/qemu-ifup b/emulators/qemu/files/qemu-ifup index 94b7a6ef7f6..38e7c6d891f 100644 --- a/emulators/qemu/files/qemu-ifup +++ b/emulators/qemu/files/qemu-ifup @@ -15,4 +15,4 @@ $SUDO ifconfig $1 link0 up # Set up our bridge $SUDO ifconfig $BRIDGE create $SUDO brconfig $BRIDGE add $ETHER up -$SUDO brconfig $BRIDGE add $1 up +$SUDO brconfig $BRIDGE add $1 up || true diff --git a/emulators/qemu/patches/patch-Makefile b/emulators/qemu/patches/patch-Makefile index e76da8d9e69..e21822f9d17 100644 --- a/emulators/qemu/patches/patch-Makefile +++ b/emulators/qemu/patches/patch-Makefile @@ -1,59 +1,83 @@ -$OpenBSD: patch-Makefile,v 1.3 2005/10/25 03:25:44 todd Exp $ ---- Makefile.orig Sun Sep 4 12:11:31 2005 -+++ Makefile Mon Oct 24 21:55:47 2005 -@@ -15,7 +15,7 @@ DOCS=qemu-doc.html qemu-tech.html qemu.1 +$OpenBSD: patch-Makefile,v 1.4 2006/06/08 14:33:38 todd Exp $ +--- Makefile.orig Wed May 3 15:32:58 2006 ++++ Makefile Thu May 11 20:45:07 2006 +@@ -19,7 +19,7 @@ endif all: dyngen$(EXESUF) $(TOOLS) $(DOCS) for d in $(TARGET_DIRS); do \ - $(MAKE) -C $$d $@ || exit 1 ; \ + $(MAKE) -C $$d $@ || exit $$? ; \ done - ifdef CONFIG_KQEMU - ifdef CONFIG_WIN32 -@@ -37,7 +37,7 @@ clean: + + qemu-img$(EXESUF): qemu-img.c block.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c +@@ -34,13 +34,13 @@ clean: rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~ $(MAKE) -C tests clean for d in $(TARGET_DIRS); do \ - $(MAKE) -C $$d $@ || exit 1 ; \ + $(MAKE) -C $$d $@ || exit $$? ; \ done - ifdef CONFIG_KQEMU - $(MAKE) -C kqemu clean -@@ -46,13 +46,18 @@ endif + distclean: clean - rm -f config-host.mak config-host.h + rm -f config-host.mak config-host.h $(DOCS) for d in $(TARGET_DIRS); do \ - rm -rf $$d || exit 1 ; \ + rm -rf $$d || exit $$? ; \ done KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ - ar de en-us fi fr-be hr it lv nl pl ru th \ +@@ -48,29 +48,34 @@ ar de en-us fi fr-be hr common de-ch es fo fr-ca hu ja mk nl-be pt sl tr + install-doc: $(DOCS) +- mkdir -p "$(DESTDIR)$(docdir)" +- $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" ++ mkdir -p "$(docdir)" ++ $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(docdir)" + ifndef CONFIG_WIN32 +- mkdir -p "$(DESTDIR)$(mandir)/man1" +- $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" ++ mkdir -p "$(mandir)/man1" ++ $(INSTALL) qemu.1 qemu-img.1 "$(mandir)/man1" + endif + +bindir=${PREFIX}/bin +docdir=${PREFIX}/share/doc/qemu +datadir=${PREFIX}/share/qemu +mandir=${PREFIX}/man + - install: all - mkdir -p "$(bindir)" - install -m 755 -s $(TOOLS) "$(bindir)" -@@ -71,7 +76,7 @@ ifndef CONFIG_WIN32 - install -m 644 $(addprefix keymaps/,$(KEYMAPS)) "$(datadir)/keymaps" + install: all $(if $(BUILD_DOCS),install-doc) +- mkdir -p "$(DESTDIR)$(bindir)" +- $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" +- mkdir -p "$(DESTDIR)$(datadir)" ++ mkdir -p "$(bindir)" ++ $(INSTALL) -m 755 -s $(TOOLS) "$(bindir)" ++ mkdir -p "$(datadir)" + for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ + video.x proll.elf linux_boot.bin; do \ +- $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ ++ $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(datadir)"; \ + done + ifndef CONFIG_WIN32 +- mkdir -p "$(DESTDIR)$(datadir)/keymaps" ++ mkdir -p "$(datadir)/keymaps" + for x in $(KEYMAPS); do \ +- $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ ++ $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(datadir)/keymaps"; \ + done endif for d in $(TARGET_DIRS); do \ - $(MAKE) -C $$d $@ || exit 1 ; \ + $(MAKE) -C $$d $@ || exit $$? ; \ done - ifdef CONFIG_KQEMU - cd kqemu ; ./install.sh -@@ -91,7 +96,7 @@ cscope: + + # various test targets +@@ -87,7 +92,7 @@ cscope: # documentation %.html: %.texi - texi2html -monolithic -number $< + -texi2html -monolithic -number $< - qemu.1: qemu-doc.texi - ./texi2pod.pl $< qemu.pod + %.info: %.texi + makeinfo $< -o $@ diff --git a/emulators/qemu/patches/patch-Makefile_target b/emulators/qemu/patches/patch-Makefile_target index e49ca1d9a05..543fe2ef7ce 100644 --- a/emulators/qemu/patches/patch-Makefile_target +++ b/emulators/qemu/patches/patch-Makefile_target @@ -1,6 +1,6 @@ -$OpenBSD: patch-Makefile_target,v 1.8 2006/04/10 21:10:05 todd Exp $ ---- Makefile.target.orig Mon Dec 19 16:51:53 2005 -+++ Makefile.target Mon Feb 20 21:21:20 2006 +$OpenBSD: patch-Makefile_target,v 1.9 2006/06/08 14:33:38 todd Exp $ +--- Makefile.target.orig Wed May 3 15:32:58 2006 ++++ Makefile.target Thu May 11 20:49:55 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) @@ -12,7 +12,7 @@ $OpenBSD: patch-Makefile_target,v 1.8 2006/04/10 21:10:05 todd Exp $ LDFLAGS=-g LIBS= HELPER_CFLAGS=$(CFLAGS) -@@ -137,7 +138,7 @@ LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64 +@@ -132,7 +133,7 @@ LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64 endif ifeq ($(ARCH),arm) @@ -21,7 +21,7 @@ $OpenBSD: patch-Makefile_target,v 1.8 2006/04/10 21:10:05 todd Exp $ LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld endif -@@ -146,6 +147,12 @@ OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer +@@ -141,6 +142,12 @@ OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer LDFLAGS+=-Wl,-T,m68k.ld endif @@ -34,7 +34,7 @@ $OpenBSD: patch-Makefile_target,v 1.8 2006/04/10 21:10:05 todd Exp $ 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 -@@ -159,6 +166,7 @@ endif +@@ -154,6 +161,7 @@ endif ######################################################### DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE @@ -42,7 +42,7 @@ $OpenBSD: patch-Makefile_target,v 1.8 2006/04/10 21:10:05 todd Exp $ LIBS+=-lm ifndef CONFIG_USER_ONLY LIBS+=-lz -@@ -275,6 +283,9 @@ VL_OBJS+=block-cow.o block-qcow.o aes.o +@@ -280,6 +288,9 @@ endif SOUND_HW = sb16.o es1370.o AUDIODRV = audio.o noaudio.o wavaudio.o @@ -52,21 +52,21 @@ $OpenBSD: patch-Makefile_target,v 1.8 2006/04/10 21:10:05 todd Exp $ ifdef CONFIG_SDL AUDIODRV += sdlaudio.o endif -@@ -308,7 +319,7 @@ ifeq ($(TARGET_BASE_ARCH), i386) +@@ -316,7 +327,7 @@ ifeq ($(TARGET_BASE_ARCH), i386) # Hardware support - VL_OBJS+= ide.o ne2000.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV) - VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o + VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV) + VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o -VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o +VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o pcnet.o DEFINES += -DHAS_AUDIO endif ifeq ($(TARGET_BASE_ARCH), ppc) -@@ -462,7 +473,7 @@ clean: +@@ -492,7 +503,7 @@ clean: install: all ifneq ($(PROGS),) -- install -m 755 -s $(PROGS) "$(bindir)" -+ install -m 755 -s $(PROGS) "$(PREFIX)/bin/" +- $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)" ++ $(INSTALL) -m 755 -s $(PROGS) "${PREFIX}/bin/" endif ifneq ($(wildcard .depend),) diff --git a/emulators/qemu/patches/patch-configure b/emulators/qemu/patches/patch-configure index a6ae81bcabd..87bdb827078 100644 --- a/emulators/qemu/patches/patch-configure +++ b/emulators/qemu/patches/patch-configure @@ -1,6 +1,6 @@ -$OpenBSD: patch-configure,v 1.4 2006/02/08 13:44:17 todd Exp $ ---- configure.orig Mon Dec 19 16:51:53 2005 -+++ configure Wed Feb 8 06:05:57 2006 +$OpenBSD: patch-configure,v 1.5 2006/06/08 14:33:38 todd Exp $ +--- configure.orig Wed May 3 15:32:58 2006 ++++ configure Fri May 5 22:07:38 2006 @@ -21,8 +21,8 @@ prefix="" interp_prefix="/usr/gnemul/qemu-%M" static="no" @@ -11,8 +11,8 @@ $OpenBSD: patch-configure,v 1.4 2006/02/08 13:44:17 todd Exp $ +host_cc="${CC:-cc}" ar="ar" make="make" - strip="strip" -@@ -41,7 +41,7 @@ case "$cpu" in + install="install" +@@ -42,7 +42,7 @@ case "$cpu" in alpha) cpu="alpha" ;; @@ -21,7 +21,7 @@ $OpenBSD: patch-configure,v 1.4 2006/02/08 13:44:17 todd Exp $ cpu="powerpc" ;; mips) -@@ -65,6 +65,9 @@ case "$cpu" in +@@ -66,6 +66,9 @@ case "$cpu" in x86_64|amd64) cpu="x86_64" ;; @@ -31,7 +31,7 @@ $OpenBSD: patch-configure,v 1.4 2006/02/08 13:44:17 todd Exp $ *) cpu="unknown" ;; -@@ -113,6 +116,7 @@ oss="yes" +@@ -119,6 +122,7 @@ oss="yes" ;; OpenBSD) bsd="yes" @@ -39,7 +39,7 @@ $OpenBSD: patch-configure,v 1.4 2006/02/08 13:44:17 todd Exp $ oss="yes" ;; Darwin) -@@ -400,7 +404,7 @@ else +@@ -495,7 +499,7 @@ else if test -z "$prefix" ; then prefix="/usr/local" fi @@ -48,7 +48,7 @@ $OpenBSD: patch-configure,v 1.4 2006/02/08 13:44:17 todd Exp $ datadir="$prefix/share/qemu" docdir="$prefix/share/doc/qemu" bindir="$prefix/bin" -@@ -468,9 +472,7 @@ if test "$darwin" = "yes" ; then +@@ -523,9 +527,7 @@ if test "$darwin" = "yes" ; then echo "Cocoa support $cocoa" fi echo "SDL support $sdl" @@ -59,7 +59,7 @@ $OpenBSD: patch-configure,v 1.4 2006/02/08 13:44:17 todd Exp $ echo "mingw32 support $mingw32" echo "Adlib support $adlib" echo "CoreAudio support $coreaudio" -@@ -539,6 +541,9 @@ if test "$cpu" = "i386" ; then +@@ -586,6 +588,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 +69,7 @@ $OpenBSD: patch-configure,v 1.4 2006/02/08 13:44:17 todd Exp $ elif test "$cpu" = "armv4b" ; then echo "ARCH=arm" >> $config_mak echo "#define HOST_ARM 1" >> $config_h -@@ -611,6 +616,9 @@ fi +@@ -665,6 +670,9 @@ fi if test "$oss" = "yes" ; then echo "CONFIG_OSS=yes" >> $config_mak echo "#define CONFIG_OSS 1" >> $config_h @@ -79,7 +79,7 @@ $OpenBSD: patch-configure,v 1.4 2006/02/08 13:44:17 todd Exp $ fi if test "$coreaudio" = "yes" ; then echo "CONFIG_COREAUDIO=yes" >> $config_mak -@@ -655,6 +663,13 @@ if [ "$bsd" = "yes" ] ; then +@@ -703,6 +711,13 @@ if [ "$bsd" = "yes" ] ; then echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h echo "#define _BSD 1" >> $config_h fi @@ -92,4 +92,4 @@ $OpenBSD: patch-configure,v 1.4 2006/02/08 13:44:17 todd Exp $ +fi for target in $target_list; do - + target_dir="$target" diff --git a/emulators/qemu/patches/patch-disas_c b/emulators/qemu/patches/patch-disas_c index bdae9ea6a68..835f1907ff7 100644 --- a/emulators/qemu/patches/patch-disas_c +++ b/emulators/qemu/patches/patch-disas_c @@ -1,7 +1,7 @@ -$OpenBSD: patch-disas_c,v 1.1 2006/04/10 21:10:05 todd Exp $ ---- disas.c.orig Sat Apr 1 08:42:02 2006 -+++ disas.c Sat Apr 1 08:44:56 2006 -@@ -270,7 +270,7 @@ void disas(FILE *out, void *code, unsign +$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 */ diff --git a/emulators/qemu/patches/patch-dyngen-exec_h b/emulators/qemu/patches/patch-dyngen-exec_h index f92e965e71a..0436f93fed3 100644 --- a/emulators/qemu/patches/patch-dyngen-exec_h +++ b/emulators/qemu/patches/patch-dyngen-exec_h @@ -1,9 +1,9 @@ -$OpenBSD: patch-dyngen-exec_h,v 1.2 2005/08/11 01:15:17 todd Exp $ ---- dyngen-exec.h.orig Wed Apr 27 10:09:39 2005 -+++ dyngen-exec.h Wed Apr 27 10:23:02 2005 -@@ -20,11 +20,15 @@ - #if !defined(__DYNGEN_EXEC_H__) - #define __DYNGEN_EXEC_H__ +$OpenBSD: patch-dyngen-exec_h,v 1.3 2006/06/08 14:33:38 todd Exp $ +--- dyngen-exec.h.orig Wed May 3 15:32:58 2006 ++++ dyngen-exec.h Fri May 5 22:07:38 2006 +@@ -27,11 +27,15 @@ + #define _FILEDEFED + #endif +#include "config.h" + @@ -18,7 +18,7 @@ $OpenBSD: patch-dyngen-exec_h,v 1.2 2005/08/11 01:15:17 todd Exp $ typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; -@@ -43,6 +47,7 @@ typedef signed long int64_t; +@@ -55,6 +59,7 @@ typedef signed long int64_t; #else typedef signed long long int64_t; #endif @@ -26,7 +26,7 @@ $OpenBSD: patch-dyngen-exec_h,v 1.2 2005/08/11 01:15:17 todd Exp $ #define INT8_MIN (-128) #define INT16_MIN (-32767-1) -@@ -57,11 +62,15 @@ typedef signed long long int64_t; +@@ -69,11 +74,15 @@ typedef signed long long int64_t; #define UINT32_MAX (4294967295U) #define UINT64_MAX ((uint64_t)(18446744073709551615)) diff --git a/emulators/qemu/patches/patch-exec_c b/emulators/qemu/patches/patch-exec_c index 2740ba2b747..16253e3bd93 100644 --- a/emulators/qemu/patches/patch-exec_c +++ b/emulators/qemu/patches/patch-exec_c @@ -1,7 +1,7 @@ -$OpenBSD: patch-exec_c,v 1.3 2005/12/27 07:56:15 todd Exp $ ---- exec.c.orig Mon Dec 19 16:51:53 2005 -+++ exec.c Tue Dec 20 08:06:20 2005 -@@ -1951,7 +1951,7 @@ void cpu_physical_memory_rw(target_phys_ +$OpenBSD: patch-exec_c,v 1.4 2006/06/08 14:33:38 todd Exp $ +--- exec.c.orig Wed May 3 15:32:58 2006 ++++ exec.c Fri May 5 22:07:38 2006 +@@ -1999,7 +1999,7 @@ void cpu_physical_memory_rw(target_phys_ target_phys_addr_t page; unsigned long pd; PhysPageDesc *p; diff --git a/emulators/qemu/patches/patch-fpu_softfloat-native_h b/emulators/qemu/patches/patch-fpu_softfloat-native_h index 56325f14152..334a664d765 100644 --- a/emulators/qemu/patches/patch-fpu_softfloat-native_h +++ b/emulators/qemu/patches/patch-fpu_softfloat-native_h @@ -1,16 +1,16 @@ -$OpenBSD: patch-fpu_softfloat-native_h,v 1.1 2005/08/11 01:15:17 todd Exp $ ---- fpu/softfloat-native.h.orig Sun Mar 20 04:33:58 2005 -+++ fpu/softfloat-native.h Wed Apr 27 14:27:41 2005 +$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 @@ -1,4 +1,5 @@ /* Native implementation of soft float functions */ +#include "gnu-c99-math.h" #include - #if defined(_BSD) && !defined(__APPLE__) - #include -@@ -34,6 +35,11 @@ typedef union { + + #if (defined(_BSD) && !defined(__APPLE__)) || defined(HOST_SOLARIS) +@@ -61,6 +62,11 @@ typedef union { | Software IEC/IEEE floating-point rounding mode. *----------------------------------------------------------------------------*/ - #if defined(_BSD) && !defined(__APPLE__) + #if (defined(_BSD) && !defined(__APPLE__)) || defined(HOST_SOLARIS) +#if defined(__OpenBSD__) +#define FE_RM FP_RM +#define FE_RP FP_RP @@ -18,4 +18,4 @@ $OpenBSD: patch-fpu_softfloat-native_h,v 1.1 2005/08/11 01:15:17 todd Exp $ +#endif enum { float_round_nearest_even = FP_RN, - float_round_down = FE_RM, + float_round_down = FP_RM, diff --git a/emulators/qemu/patches/patch-gnu-c99-math_h b/emulators/qemu/patches/patch-gnu-c99-math_h index e3fa58fd840..9dbed8fc9bd 100644 --- a/emulators/qemu/patches/patch-gnu-c99-math_h +++ b/emulators/qemu/patches/patch-gnu-c99-math_h @@ -1,7 +1,7 @@ -$OpenBSD: patch-gnu-c99-math_h,v 1.2 2005/11/25 04:12:54 todd Exp $ ---- gnu-c99-math.h.orig Thu Nov 24 20:19:46 2005 -+++ gnu-c99-math.h Thu Nov 24 20:22:25 2005 -@@ -0,0 +1,22 @@ +$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 +@@ -0,0 +1,23 @@ +#if (defined(__sun__) || defined(__OpenBSD__)) && defined(__GNUC__) + +/* @@ -13,6 +13,7 @@ $OpenBSD: patch-gnu-c99-math_h,v 1.2 2005/11/25 04:12:54 todd Exp $ + * Try to workaround the missing / broken C99 math macros. + */ +#include ++#include + +#define isnormal(x) (fabs(x) < DBL_EPSILON && !isnan(x) && !isinf(x)) + diff --git a/emulators/qemu/patches/patch-hw_lance_c b/emulators/qemu/patches/patch-hw_lance_c deleted file mode 100644 index cc85baf2ebe..00000000000 --- a/emulators/qemu/patches/patch-hw_lance_c +++ /dev/null @@ -1,24 +0,0 @@ -$OpenBSD: patch-hw_lance_c,v 1.1 2006/02/08 13:44:17 todd Exp $ ---- hw/lance.c.orig Mon Dec 19 17:51:53 2005 -+++ hw/lance.c Sat Jan 28 22:10:33 2006 -@@ -283,6 +283,11 @@ static CPUWriteMemoryFunc *lance_mem_wri - - #define MIN_BUF_SIZE 60 - -+static void lance_can_receive(void *opaque) -+{ -+ return 1; -+} -+ - static void lance_receive(void *opaque, const uint8_t *buf, int size) - { - LANCEState *s = opaque; -@@ -440,7 +445,7 @@ void lance_init(NICInfo *nd, int irq, ui - - lance_reset(s); - -- s->vc = qemu_new_vlan_client(nd->vlan, lance_receive, s); -+ s->vc = qemu_new_vlan_client(nd->vlan, lance_receive, lance_can_receive, s); - - snprintf(s->vc->info_str, sizeof(s->vc->info_str), - "lance macaddr=%02x:%02x:%02x:%02x:%02x:%02x", diff --git a/emulators/qemu/patches/patch-hw_ne2000_c b/emulators/qemu/patches/patch-hw_ne2000_c index 023cdfe3153..5ddde1f9ecf 100644 --- a/emulators/qemu/patches/patch-hw_ne2000_c +++ b/emulators/qemu/patches/patch-hw_ne2000_c @@ -1,71 +1,12 @@ -$OpenBSD: patch-hw_ne2000_c,v 1.1 2006/02/08 13:44:17 todd Exp $ ---- hw/ne2000.c.orig Mon Dec 19 17:51:53 2005 -+++ hw/ne2000.c Sat Jan 28 22:10:33 2006 -@@ -200,14 +200,10 @@ static int compute_mcast_idx(const uint8 - return (crc >> 26); - } +$OpenBSD: patch-hw_ne2000_c,v 1.2 2006/06/08 14:33:38 todd Exp $ +--- hw/ne2000.c.orig Sun May 14 19:09:39 2006 ++++ hw/ne2000.c Sun May 14 19:09:12 2006 +@@ -206,7 +206,7 @@ static int ne2000_buffer_full(NE2000Stat --/* return the max buffer size if the NE2000 can receive more data */ --static int ne2000_can_receive(void *opaque) -+static int ne2000_buffer_full(NE2000State *s) - { -- NE2000State *s = opaque; - int avail, index, boundary; -- -- if (s->cmd & E8390_STOP) -- return 0; -+ index = s->curpag << 8; boundary = s->boundary << 8; - if (index < boundary) -@@ -215,10 +211,19 @@ static int ne2000_can_receive(void *opaq +- if (index < boundary) ++ if (index <= boundary) + avail = boundary - index; else avail = (s->stop - s->start) - (index - boundary); - if (avail < (MAX_ETH_FRAME_SIZE + 4)) -- return 0; -- return MAX_ETH_FRAME_SIZE; -+ return 1; -+ return 0; - } - -+static int ne2000_can_receive(void *opaque) -+{ -+ NE2000State *s = opaque; -+ -+ if (s->cmd & E8390_STOP) -+ return 1; -+ return !ne2000_buffer_full(s); -+} -+ - #define MIN_BUF_SIZE 60 - - static void ne2000_receive(void *opaque, const uint8_t *buf, int size) -@@ -234,7 +239,7 @@ static void ne2000_receive(void *opaque, - printf("NE2000: received len=%d\n", size); - #endif - -- if (!ne2000_can_receive(s)) -+ if (s->cmd & E8390_STOP || ne2000_buffer_full(s)) - return; - - /* XXX: check this */ -@@ -715,7 +720,8 @@ void isa_ne2000_init(int base, int irq, - - ne2000_reset(s); - -- s->vc = qemu_new_vlan_client(nd->vlan, ne2000_receive, s); -+ s->vc = qemu_new_vlan_client(nd->vlan, ne2000_receive, -+ ne2000_can_receive, s); - - snprintf(s->vc->info_str, sizeof(s->vc->info_str), - "ne2000 macaddr=%02x:%02x:%02x:%02x:%02x:%02x", -@@ -784,7 +790,8 @@ void pci_ne2000_init(PCIBus *bus, NICInf - s->pci_dev = (PCIDevice *)d; - memcpy(s->macaddr, nd->macaddr, 6); - ne2000_reset(s); -- s->vc = qemu_new_vlan_client(nd->vlan, ne2000_receive, s); -+ s->vc = qemu_new_vlan_client(nd->vlan, ne2000_receive, -+ ne2000_can_receive, s); - - snprintf(s->vc->info_str, sizeof(s->vc->info_str), - "ne2000 pci macaddr=%02x:%02x:%02x:%02x:%02x:%02x", diff --git a/emulators/qemu/patches/patch-hw_pc_c b/emulators/qemu/patches/patch-hw_pc_c index 65355a484c6..59af3a2d7bf 100644 --- a/emulators/qemu/patches/patch-hw_pc_c +++ b/emulators/qemu/patches/patch-hw_pc_c @@ -1,16 +1,16 @@ -$OpenBSD: patch-hw_pc_c,v 1.3 2006/02/16 16:27:44 todd Exp $ ---- hw/pc.c.orig Mon Dec 19 16:51:53 2005 -+++ hw/pc.c Tue Dec 20 11:22:29 2005 -@@ -616,7 +616,7 @@ static void pc_init1(int ram_size, int v +$OpenBSD: patch-hw_pc_c,v 1.4 2006/06/08 14:33:38 todd Exp $ +--- hw/pc.c.orig Wed May 3 15:32:58 2006 ++++ hw/pc.c Fri May 5 22:16:41 2006 +@@ -609,7 +609,7 @@ static void pc_init1(int ram_size, int v char buf[1024]; - int ret, linux_boot, initrd_size, i, nb_nics1; + int ret, linux_boot, initrd_size, i; unsigned long bios_offset, vga_bios_offset; - int bios_size, isa_bios_size; + int bios_size, isa_bios_size, vga_bios_size; PCIBus *pci_bus; CPUState *env; - -@@ -668,8 +668,12 @@ static void pc_init1(int ram_size, int v + NICInfo *nd; +@@ -662,8 +662,12 @@ static void pc_init1(int ram_size, int v } else { snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME); } @@ -24,17 +24,11 @@ $OpenBSD: patch-hw_pc_c,v 1.3 2006/02/16 16:27:44 todd Exp $ /* setup basic memory access */ cpu_register_physical_memory(0xc0000, 0x10000, vga_bios_offset | IO_MEM_ROM); -@@ -802,7 +806,12 @@ static void pc_init1(int ram_size, int v - - if (pci_enabled) { - for(i = 0; i < nb_nics; i++) { -- pci_ne2000_init(pci_bus, &nd_table[i]); -+#if 1 -+ if (nic_pcnet) -+ pci_pcnet_init(pci_bus, &nd_table[i]); -+ else -+#endif -+ pci_ne2000_init(pci_bus, &nd_table[i]); +@@ -793,6 +797,7 @@ static void pc_init1(int ram_size, int v } - pci_piix3_ide_init(pci_bus, bs_table); - } else { + } + ++/* XXX where to insert pci_pcnet_init(pci_bus, &nd_table[i]); ??? */ + for(i = 0; i < nb_nics; i++) { + nd = &nd_table[i]; + if (!nd->model) { diff --git a/emulators/qemu/patches/patch-hw_rtl8139_c b/emulators/qemu/patches/patch-hw_rtl8139_c new file mode 100644 index 00000000000..30bc39e6d69 --- /dev/null +++ b/emulators/qemu/patches/patch-hw_rtl8139_c @@ -0,0 +1,413 @@ +$OpenBSD: patch-hw_rtl8139_c,v 1.1 2006/06/08 14:33:38 todd Exp $ +--- hw/rtl8139.c.orig Wed May 3 15:32:58 2006 ++++ hw/rtl8139.c Thu May 11 22:17:23 2006 +@@ -32,6 +32,8 @@ + /* debug RTL8139 card */ + //#define DEBUG_RTL8139 1 + ++#define PCI_FREQUENCY 33000000L ++ + /* debug RTL8139 card C+ mode only */ + //#define DEBUG_RTL8139CP 1 + +@@ -315,6 +317,11 @@ enum chip_flags { + (b30<<30 | b29<<29 | b28<<28 | b27<<27 | b26<<26 | b23<<23 | b22<<22) + #define HW_REVID_MASK HW_REVID(1, 1, 1, 1, 1, 1, 1) + ++#define RTL8139_PCI_REVID_8139 0x10 ++#define RTL8139_PCI_REVID_8139CPLUS 0x20 ++ ++#define RTL8139_PCI_REVID RTL8139_PCI_REVID_8139CPLUS ++ + /* Size is 64 * 16bit words */ + #define EEPROM_9346_ADDR_BITS 6 + #define EEPROM_9346_SIZE (1 << EEPROM_9346_ADDR_BITS) +@@ -414,7 +421,13 @@ typedef struct RTL8139State { + uint32_t RxRingAddrHI; + + EEprom9346 eeprom; +- ++ ++ uint32_t TCTR; ++ uint32_t TimerInt; ++ int64_t TCTR_base; ++ ++ QEMUTimer *timer; ++ + } RTL8139State; + + void prom9346_decode_command(EEprom9346 *eeprom, uint8_t command) +@@ -512,6 +525,19 @@ void prom9346_shift_clock(EEprom9346 *ee + eeprom->output <<= 1; + if (eeprom->tick == 16) + { ++#if 1 ++ // the FreeBSD drivers (rl and re) don't explicitly toggle ++ // CS between reads (or does setting Cfg9346 to 0 count too?), ++ // so we need to enter wait-for-command state here ++ eeprom->mode = Chip9346_enter_command_mode; ++ eeprom->input = 0; ++ eeprom->tick = 0; ++ ++#if defined(DEBUG_RTL8139) ++ printf("eeprom: +++ end of read, awaiting next command\n"); ++#endif ++#else ++ // original behaviour + ++eeprom->address; + eeprom->address &= EEPROM_9346_ADDR_MASK; + eeprom->output = eeprom->contents[eeprom->address]; +@@ -521,6 +547,7 @@ void prom9346_shift_clock(EEprom9346 *ee + printf("eeprom: +++ read next address 0x%02x data=0x%04x\n", + eeprom->address, eeprom->output); + #endif ++#endif + } + break; + +@@ -751,7 +778,7 @@ static int rtl8139_can_receive(void *opa + } + } + +-static void rtl8139_receive(void *opaque, const uint8_t *buf, int size) ++static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int do_interrupt) + { + RTL8139State *s = opaque; + +@@ -1078,9 +1105,18 @@ static void rtl8139_receive(void *opaque + } + + s->IntrStatus |= RxOK; +- rtl8139_update_irq(s); ++ ++ if (do_interrupt) ++ { ++ rtl8139_update_irq(s); ++ } + } + ++static void rtl8139_receive(void *opaque, const uint8_t *buf, int size) ++{ ++ rtl8139_do_receive(opaque, buf, size, 1); ++} ++ + static void rtl8139_reset_rxring(RTL8139State *s, uint32_t bufferSize) + { + s->RxBufferSize = bufferSize; +@@ -1103,6 +1139,11 @@ static void rtl8139_reset(RTL8139State * + + /* prepare eeprom */ + s->eeprom.contents[0] = 0x8129; ++#if 1 ++ // PCI vendor and device ID should be mirrored here ++ s->eeprom.contents[1] = 0x10ec; ++ s->eeprom.contents[2] = 0x8139; ++#endif + memcpy(&s->eeprom.contents[7], s->macaddr, 6); + + /* mark all status registers as owned by host */ +@@ -1129,7 +1170,7 @@ static void rtl8139_reset(RTL8139State * + // s->TxConfig |= HW_REVID(1, 0, 0, 0, 0, 0, 0); // RTL-8139 HasHltClk + s->clock_enabled = 0; + #else +- s->TxConfig |= HW_REVID(1, 1, 1, 0, 1, 0, 0); // RTL-8139C HasLWake ++ s->TxConfig |= HW_REVID(1, 1, 1, 0, 1, 1, 0); // RTL-8139C+ HasLWake + s->clock_enabled = 1; + #endif + +@@ -1157,6 +1198,11 @@ static void rtl8139_reset(RTL8139State * + s->NWayAdvert = 0x05e1; /* all modes, full duplex */ + s->NWayLPAR = 0x05e1; /* all modes, full duplex */ + s->NWayExpansion = 0x0001; /* autonegotiation supported */ ++ ++ /* also reset timer and disable timer interrupt */ ++ s->TCTR = 0; ++ s->TimerInt = 0; ++ s->TCTR_base = 0; + } + + static void rtl8139_ChipCmd_write(RTL8139State *s, uint32_t val) +@@ -1622,13 +1668,23 @@ static int rtl8139_transmit_one(RTL8139S + #endif + cpu_physical_memory_read(s->TxAddr[descriptor], txbuffer, txsize); + +- qemu_send_packet(s->vc, txbuffer, txsize); +- + /* Mark descriptor as transferred */ + s->TxStatus[descriptor] |= TxHostOwns; + s->TxStatus[descriptor] |= TxStatOK; + ++ if (TxLoopBack == (s->TxConfig & TxLoopBack)) ++ { + #ifdef DEBUG_RTL8139 ++ printf("RTL8139: +++ transmit loopback mode\n"); ++#endif ++ rtl8139_do_receive(s, txbuffer, txsize, 0); ++ } ++ else ++ { ++ qemu_send_packet(s->vc, txbuffer, txsize); ++ } ++ ++#ifdef DEBUG_RTL8139 + printf("RTL8139: +++ transmitted %d bytes from descriptor %d\n", txsize, descriptor); + #endif + +@@ -1748,9 +1804,6 @@ static int rtl8139_cplus_transmit_one(RT + #endif + cpu_physical_memory_read(tx_addr, txbuffer, txsize); + +- /* transmit the packet */ +- qemu_send_packet(s->vc, txbuffer, txsize); +- + /* transfer ownership to target */ + txdw0 &= ~CP_RX_OWN; + +@@ -1777,7 +1830,20 @@ static int rtl8139_cplus_transmit_one(RT + ++s->currCPlusTxDesc; + } + ++ if (TxLoopBack == (s->TxConfig & TxLoopBack)) ++ { + #ifdef DEBUG_RTL8139 ++ printf("RTL8139: +++ C+ transmit loopback mode\n"); ++#endif ++ rtl8139_receive(s, txbuffer, txsize); ++ } ++ else ++ { ++ /* transmit the packet */ ++ qemu_send_packet(s->vc, txbuffer, txsize); ++ } ++ ++#ifdef DEBUG_RTL8139 + printf("RTL8139: +++ C+ mode transmitted %d bytes from descriptor %d\n", txsize, descriptor); + #endif + return 1; +@@ -1909,6 +1975,8 @@ static void rtl8139_TxAddr_write(RTL8139 + #endif + + s->TxAddr[txAddrOffset/4] = le32_to_cpu(val); ++ ++ s->currCPlusTxDesc = 0; + } + + static uint32_t rtl8139_TxAddr_read(RTL8139State *s, uint32_t txAddrOffset) +@@ -1949,6 +2017,18 @@ static uint32_t rtl8139_RxBufPtr_read(RT + return ret; + } + ++static uint32_t rtl8139_RxBufAddr_read(RTL8139State *s) ++{ ++ /* this value is NOT off by 16 */ ++ uint32_t ret = s->RxBufAddr; ++ ++#ifdef DEBUG_RTL8139 ++ printf("RTL8139: RxBufAddr read val=0x%04x\n", ret); ++#endif ++ ++ return ret; ++} ++ + static void rtl8139_RxBuf_write(RTL8139State *s, uint32_t val) + { + #ifdef DEBUG_RTL8139 +@@ -2281,6 +2361,21 @@ static void rtl8139_io_writel(void *opaq + s->RxRingAddrHI = val; + break; + ++ case Timer: ++#ifdef DEBUG_RTL8139 ++ printf("RTL8139: TCTR Timer reset on write\n"); ++#endif ++ s->TCTR = 0; ++ s->TCTR_base = qemu_get_clock(vm_clock); ++ break; ++ ++ case FlashReg: ++#ifdef DEBUG_RTL8139 ++ printf("RTL8139: FlashReg TimerInt write val=0x%08x\n", val); ++#endif ++ s->TimerInt = val; ++ break; ++ + default: + #ifdef DEBUG_RTL8139 + printf("RTL8139: ioport write(l) addr=0x%x val=0x%08x via write(b)\n", addr, val); +@@ -2355,7 +2450,7 @@ static uint32_t rtl8139_io_readb(void *o + break; + + case PCIRevisionID: +- ret = 0x10; ++ ret = RTL8139_PCI_REVID; + #ifdef DEBUG_RTL8139 + printf("RTL8139: PCI Revision ID read 0x%x\n", ret); + #endif +@@ -2411,6 +2506,10 @@ static uint32_t rtl8139_io_readw(void *o + ret = rtl8139_RxBufPtr_read(s); + break; + ++ case RxBufAddr: ++ ret = rtl8139_RxBufAddr_read(s); ++ break; ++ + case BasicModeCtrl: + ret = rtl8139_BasicModeCtrl_read(s); + break; +@@ -2521,6 +2620,20 @@ static uint32_t rtl8139_io_readl(void *o + #endif + break; + ++ case Timer: ++ ret = s->TCTR; ++#ifdef DEBUG_RTL8139 ++ printf("RTL8139: TCTR Timer read val=0x%08x\n", ret); ++#endif ++ break; ++ ++ case FlashReg: ++ ret = s->TimerInt; ++#ifdef DEBUG_RTL8139 ++ printf("RTL8139: FlashReg TimerInt read val=0x%08x\n", ret); ++#endif ++ break; ++ + default: + #ifdef DEBUG_RTL8139 + printf("RTL8139: ioport read(l) addr=0x%x via read(b)\n", addr); +@@ -2688,6 +2801,10 @@ static void rtl8139_save(QEMUFile* f,voi + qemu_put_8s(f, &s->eeprom.eesk); + qemu_put_8s(f, &s->eeprom.eedi); + qemu_put_8s(f, &s->eeprom.eedo); ++ ++ qemu_put_be32s(f, &s->TCTR); ++ qemu_put_be32s(f, &s->TimerInt); ++ qemu_put_be64s(f, &s->TCTR_base); + } + + static int rtl8139_load(QEMUFile* f,void* opaque,int version_id) +@@ -2695,9 +2812,11 @@ static int rtl8139_load(QEMUFile* f,void + RTL8139State* s=(RTL8139State*)opaque; + int i; + +- if (version_id != 1) ++ /* just 2 versions for now */ ++ if (version_id > 2) + return -EINVAL; + ++ /* saved since version 1 */ + qemu_get_buffer(f, s->phys, 6); + qemu_get_buffer(f, s->mult, 8); + +@@ -2769,7 +2888,22 @@ static int rtl8139_load(QEMUFile* f,void + qemu_get_8s(f, &s->eeprom.eedi); + qemu_get_8s(f, &s->eeprom.eedo); + +- return 0; ++ /* saved since version 2 */ ++ if (version_id >= 2) ++ { ++ qemu_get_be32s(f, &s->TCTR); ++ qemu_get_be32s(f, &s->TimerInt); ++ qemu_get_be64s(f, &s->TCTR_base); ++ } ++ else ++ { ++ /* not saved, use default */ ++ s->TCTR = 0; ++ s->TimerInt = 0; ++ s->TCTR_base = 0; ++ } ++ ++ return 0; + } + + /***********************************************************/ +@@ -2817,6 +2951,63 @@ static CPUWriteMemoryFunc *rtl8139_mmio_ + rtl8139_mmio_writel, + }; + ++static inline int64_t rtl8139_get_next_tctr_time(RTL8139State *s, int64_t current_time) ++{ ++ int64_t next_time = current_time + ++ muldiv64(1, ticks_per_sec, PCI_FREQUENCY); ++ if (next_time <= current_time) ++ next_time = current_time + 1; ++ return next_time; ++} ++ ++static void rtl8139_timer(void *opaque) ++{ ++ RTL8139State *s = opaque; ++ ++ int is_timeout = 0; ++ ++ int64_t curr_time; ++ uint32_t curr_tick; ++ ++ if (!s->clock_enabled) ++ { ++#ifdef DEBUG_RTL8139 ++ printf("RTL8139: >>> timer: clock is not running\n"); ++#endif ++ return; ++ } ++ ++ curr_time = qemu_get_clock(vm_clock); ++ ++ curr_tick = muldiv64(curr_time - s->TCTR_base, PCI_FREQUENCY, ticks_per_sec); ++ ++ if (s->TimerInt && curr_tick >= s->TimerInt) ++ { ++ if (s->TCTR < s->TimerInt || curr_tick < s->TCTR) ++ { ++ is_timeout = 1; ++ } ++ } ++ ++ s->TCTR = curr_tick; ++ ++#ifdef DEBUG_RTL8139 ++ printf("RTL8139: >>> timer: tick=%08u\n", s->TCTR); ++#endif ++ ++ if (is_timeout) ++ { ++#ifdef DEBUG_RTL8139 ++ printf("RTL8139: >>> timer: timeout tick=%08u\n", s->TCTR); ++#endif ++ s->IntrStatus |= PCSTimeout; ++ rtl8139_update_irq(s); ++ } ++ ++ qemu_mod_timer(s->timer, ++ rtl8139_get_next_tctr_time(s,curr_time)); ++} ++ + void pci_rtl8139_init(PCIBus *bus, NICInfo *nd) + { + PCIRTL8139State *d; +@@ -2833,7 +3024,7 @@ void pci_rtl8139_init(PCIBus *bus, NICIn + pci_conf[0x02] = 0x39; + pci_conf[0x03] = 0x81; + pci_conf[0x04] = 0x05; /* command = I/O space, Bus Master */ +- pci_conf[0x08] = 0x20; /* 0x10 */ /* PCI revision ID; >=0x20 is for 8139C+ */ ++ pci_conf[0x08] = RTL8139_PCI_REVID; /* PCI revision ID; >=0x20 is for 8139C+ */ + pci_conf[0x0a] = 0x00; /* ethernet network controller */ + pci_conf[0x0b] = 0x02; + pci_conf[0x0e] = 0x00; /* header_type */ +@@ -2869,7 +3060,13 @@ void pci_rtl8139_init(PCIBus *bus, NICIn + s->macaddr[5]); + + /* XXX: instance number ? */ +- register_savevm("rtl8139", 0, 1, rtl8139_save, rtl8139_load, s); ++ register_savevm("rtl8139", 0, 2, rtl8139_save, rtl8139_load, s); + register_savevm("rtl8139_pci", 0, 1, generic_pci_save, generic_pci_load, + &d->dev); ++ ++ s->timer = qemu_new_timer(vm_clock, rtl8139_timer, s); ++ ++ qemu_mod_timer(s->timer, ++ rtl8139_get_next_tctr_time(s,qemu_get_clock(vm_clock))); + } ++ diff --git a/emulators/qemu/patches/patch-hw_smc91c111_c b/emulators/qemu/patches/patch-hw_smc91c111_c deleted file mode 100644 index 641281bb029..00000000000 --- a/emulators/qemu/patches/patch-hw_smc91c111_c +++ /dev/null @@ -1,30 +0,0 @@ -$OpenBSD: patch-hw_smc91c111_c,v 1.1 2006/02/08 13:44:17 todd Exp $ ---- hw/smc91c111.c.orig Mon Dec 19 17:51:53 2005 -+++ hw/smc91c111.c Sat Jan 28 22:10:33 2006 -@@ -593,6 +593,17 @@ static uint32_t smc91c111_readl(void *op - return val; - } - -+static int smc91c111_can_receive(void *opaque) -+{ -+ smc91c111_state *s = (smc91c111_state *)opaque; -+ -+ if ((s->rcr & RCR_RXEN) == 0 || (s->rcr & RCR_SOFT_RST)) -+ return 1; -+ if (s->allocated == (1 << NUM_PACKETS) - 1) -+ return 0; -+ return 1; -+} -+ - static void smc91c111_receive(void *opaque, const uint8_t *buf, int size) - { - smc91c111_state *s = (smc91c111_state *)opaque; -@@ -697,6 +708,7 @@ void smc91c111_init(NICInfo *nd, uint32_ - - smc91c111_reset(s); - -- s->vc = qemu_new_vlan_client(nd->vlan, smc91c111_receive, s); -+ s->vc = qemu_new_vlan_client(nd->vlan, smc91c111_receive, -+ smc91c111_can_receive, s); - /* ??? Save/restore. */ - } diff --git a/emulators/qemu/patches/patch-slirp_slirp_config_h b/emulators/qemu/patches/patch-slirp_slirp_config_h index 45abf92db98..cde44b7e8f8 100644 --- a/emulators/qemu/patches/patch-slirp_slirp_config_h +++ b/emulators/qemu/patches/patch-slirp_slirp_config_h @@ -1,6 +1,6 @@ -$OpenBSD: patch-slirp_slirp_config_h,v 1.2 2005/08/11 01:15:17 todd Exp $ ---- slirp/slirp_config.h.orig Sun Jul 24 13:52:08 2005 -+++ slirp/slirp_config.h Tue Aug 9 22:34:49 2005 +$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 @@ -92,7 +92,7 @@ #undef BAD_SPRINTF @@ -28,7 +28,7 @@ $OpenBSD: patch-slirp_slirp_config_h,v 1.2 2005/08/11 01:15:17 todd Exp $ /* Define if you have sys/stropts.h */ #undef HAVE_SYS_STROPTS_H -@@ -197,7 +197,7 @@ +@@ -200,7 +200,7 @@ #undef HAVE_GRANTPT /* Define if you have fchmod */ diff --git a/emulators/qemu/patches/patch-target-arm_cpu_h b/emulators/qemu/patches/patch-target-arm_cpu_h index ee345da28c0..222ae68ac95 100644 --- a/emulators/qemu/patches/patch-target-arm_cpu_h +++ b/emulators/qemu/patches/patch-target-arm_cpu_h @@ -1,7 +1,7 @@ -$OpenBSD: patch-target-arm_cpu_h,v 1.3 2005/12/27 07:56:15 todd Exp $ ---- target-arm/cpu.h.orig Mon Dec 19 16:51:53 2005 -+++ target-arm/cpu.h Tue Dec 20 08:06:20 2005 -@@ -123,7 +123,7 @@ void switch_mode(CPUARMState *, int); +$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; diff --git a/emulators/qemu/patches/patch-target-i386_cpu_h b/emulators/qemu/patches/patch-target-i386_cpu_h index 382b34549a6..f32265f90c9 100644 --- a/emulators/qemu/patches/patch-target-i386_cpu_h +++ b/emulators/qemu/patches/patch-target-i386_cpu_h @@ -1,7 +1,7 @@ -$OpenBSD: patch-target-i386_cpu_h,v 1.3 2005/12/27 07:56:15 todd Exp $ ---- target-i386/cpu.h.orig Mon Dec 19 16:51:53 2005 -+++ target-i386/cpu.h Tue Dec 20 08:06:20 2005 -@@ -616,8 +616,7 @@ void cpu_x86_frstor(CPUX86State *s, uint +$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. */ diff --git a/emulators/qemu/patches/patch-target-i386_helper2_c b/emulators/qemu/patches/patch-target-i386_helper2_c index 0210574f464..93b85d5b6d3 100644 --- a/emulators/qemu/patches/patch-target-i386_helper2_c +++ b/emulators/qemu/patches/patch-target-i386_helper2_c @@ -1,15 +1,15 @@ -$OpenBSD: patch-target-i386_helper2_c,v 1.2 2005/12/27 07:56:15 todd Exp $ ---- target-i386/helper2.c.orig Mon Dec 19 16:51:53 2005 -+++ target-i386/helper2.c Tue Dec 20 08:06:20 2005 -@@ -123,7 +123,7 @@ CPUX86State *cpu_x86_init(void) +$OpenBSD: patch-target-i386_helper2_c,v 1.3 2006/06/08 14:33:38 todd Exp $ +--- target-i386/helper2.c.orig Wed May 3 15:32:58 2006 ++++ target-i386/helper2.c Fri May 5 22:07:41 2006 +@@ -124,7 +124,7 @@ CPUX86State *cpu_x86_init(void) env->cpuid_model[i >> 2] |= c << (8 * (i & 3)); } } -#ifdef TARGET_X86_64 +/* #ifdef TARGET_X86_64 -- You must enable it for Mac OS X x86 */ /* currently not enabled for std i386 because not fully tested */ - env->cpuid_features |= CPUID_APIC; env->cpuid_ext2_features = (env->cpuid_features & 0x0183F3FF); + env->cpuid_ext2_features |= CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX; @@ -132,7 +132,7 @@ CPUX86State *cpu_x86_init(void) /* these features are needed for Win64 and aren't fully implemented */ diff --git a/emulators/qemu/patches/patch-target-ppc_op_helper_c b/emulators/qemu/patches/patch-target-ppc_op_helper_c index b4eda0e91f1..f0cd7d4bf94 100644 --- a/emulators/qemu/patches/patch-target-ppc_op_helper_c +++ b/emulators/qemu/patches/patch-target-ppc_op_helper_c @@ -1,11 +1,11 @@ -$OpenBSD: patch-target-ppc_op_helper_c,v 1.2 2005/08/11 01:15:17 todd Exp $ ---- target-ppc/op_helper.c.orig Sun Jul 24 13:52:08 2005 -+++ target-ppc/op_helper.c Tue Aug 9 22:34:49 2005 -@@ -18,6 +18,7 @@ +$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 +@@ -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 */ - #include -+#include ++#include #include "exec.h" #define MEMSUFFIX _raw diff --git a/emulators/qemu/patches/patch-vl_c b/emulators/qemu/patches/patch-vl_c index 12cc9b4b628..90f0d115575 100644 --- a/emulators/qemu/patches/patch-vl_c +++ b/emulators/qemu/patches/patch-vl_c @@ -1,5 +1,5 @@ ---- vl.c.orig Mon Dec 19 16:51:53 2005 -+++ vl.c Mon Apr 10 16:02:04 2006 +--- vl.c.orig Wed May 3 15:32:58 2006 ++++ vl.c Fri May 5 22:24:31 2006 @@ -43,7 +43,8 @@ #include #ifdef _BSD @@ -10,7 +10,7 @@ #include #endif #else -@@ -126,6 +127,7 @@ QEMUTimer *gui_timer; +@@ -130,6 +131,7 @@ QEMUTimer *gui_timer; int vm_running; int rtc_utc = 1; int cirrus_vga_enabled = 1; @@ -18,7 +18,7 @@ #ifdef TARGET_SPARC int graphic_width = 1024; int graphic_height = 768; -@@ -288,7 +290,7 @@ void isa_unassign_ioport(int start, int +@@ -292,7 +294,7 @@ void isa_unassign_ioport(int start, int /***********************************************************/ @@ -27,7 +27,7 @@ { int c; char *q = buf; -@@ -306,7 +308,7 @@ void pstrcpy(char *buf, int buf_size, co +@@ -310,7 +312,7 @@ void pstrcpy(char *buf, int buf_size, co } /* strcat and truncate. */ @@ -36,7 +36,7 @@ { int len; len = strlen(buf); -@@ -549,7 +551,23 @@ int64_t cpu_get_real_ticks(void) +@@ -561,7 +563,23 @@ int64_t cpu_get_real_ticks(void) } #else @@ -60,8 +60,8 @@ +} #endif - static int64_t cpu_ticks_offset; -@@ -1693,7 +1711,7 @@ static int parse_macaddr(uint8_t *macadd + static int64_t cpu_ticks_prev; +@@ -2201,7 +2219,7 @@ static int parse_macaddr(uint8_t *macadd return 0; } @@ -70,73 +70,7 @@ { const char *p, *p1; int len; -@@ -1768,13 +1786,16 @@ VLANState *qemu_find_vlan(int id) - } - - VLANClientState *qemu_new_vlan_client(VLANState *vlan, -- IOReadHandler *fd_read, void *opaque) -+ IOReadHandler *fd_read, -+ IOCanRWHandler *fd_can_read, -+ void *opaque) - { - VLANClientState *vc, **pvc; - vc = qemu_mallocz(sizeof(VLANClientState)); - if (!vc) - return NULL; - vc->fd_read = fd_read; -+ vc->fd_can_read = fd_can_read; - vc->opaque = opaque; - vc->vlan = vlan; - -@@ -1786,6 +1807,20 @@ VLANClientState *qemu_new_vlan_client(VL - return vc; - } - -+int qemu_can_send_packet(VLANClientState *vc1) -+{ -+ VLANState *vlan = vc1->vlan; -+ VLANClientState *vc; -+ -+ for(vc = vlan->first_client; vc != NULL; vc = vc->next) { -+ if (vc != vc1) { -+ if (vc->fd_can_read && !vc->fd_can_read(vc->opaque)) -+ return 0; -+ } -+ } -+ return 1; -+} -+ - void qemu_send_packet(VLANClientState *vc1, const uint8_t *buf, int size) - { - VLANState *vlan = vc1->vlan; -@@ -1811,7 +1846,7 @@ static VLANClientState *slirp_vc; - - int slirp_can_output(void) - { -- return 1; -+ qemu_can_send_packet(slirp_vc); - } - - void slirp_output(const uint8_t *pkt, int pkt_len) -@@ -1839,7 +1874,7 @@ static int net_slirp_init(VLANState *vla - slirp_init(); - } - slirp_vc = qemu_new_vlan_client(vlan, -- slirp_receive, NULL); -+ slirp_receive, NULL, NULL); - snprintf(slirp_vc->info_str, sizeof(slirp_vc->info_str), "user redirector"); - return 0; - } -@@ -2024,7 +2059,7 @@ static TAPState *net_tap_fd_init(VLANSta - if (!s) - return NULL; - s->fd = fd; -- s->vc = qemu_new_vlan_client(vlan, tap_receive, s); -+ s->vc = qemu_new_vlan_client(vlan, tap_receive, NULL, s); - qemu_set_fd_handler(s->fd, tap_send, NULL, s); - snprintf(s->vc->info_str, sizeof(s->vc->info_str), "tap: fd=%d", fd); - return s; -@@ -2037,11 +2072,85 @@ static int tap_open(char *ifname, int if +@@ -2560,11 +2578,85 @@ static int tap_open(char *ifname, int if char *dev; struct stat s; @@ -222,27 +156,9 @@ fstat(fd, &s); dev = devname(s.st_rdev, S_IFCHR); -@@ -2327,7 +2436,7 @@ static NetSocketState *net_socket_fd_ini - return NULL; - s->fd = fd; +@@ -3065,7 +3157,8 @@ static int net_socket_mcast_init(VLANSta -- s->vc = qemu_new_vlan_client(vlan, net_socket_receive_dgram, s); -+ s->vc = qemu_new_vlan_client(vlan, net_socket_receive_dgram, NULL, s); - qemu_set_fd_handler(s->fd, net_socket_send_dgram, NULL, s); - - /* mcast: save bound address as dst */ -@@ -2355,7 +2464,7 @@ static NetSocketState *net_socket_fd_ini - return NULL; - s->fd = fd; - s->vc = qemu_new_vlan_client(vlan, -- net_socket_receive, s); -+ net_socket_receive, NULL, s); - snprintf(s->vc->info_str, sizeof(s->vc->info_str), - "socket: fd=%d", fd); - if (is_connected) { -@@ -2526,7 +2635,8 @@ static int net_socket_mcast_init(VLANSta - - #endif /* !_WIN32 */ + } -static int get_param_value(char *buf, int buf_size, +static int get_param_value(char *, size_t, const char *, const char *); @@ -250,7 +166,7 @@ const char *tag, const char *str) { const char *p; -@@ -2636,17 +2746,21 @@ int net_client_init(const char *str) +@@ -3190,17 +3283,21 @@ int net_client_init(const char *str) char ifname[64]; char setup_script[1024]; int fd; @@ -273,16 +189,16 @@ + ret = net_tap_init(vlan, ifname, setup_script); } } else - if (!strcmp(device, "socket")) { -@@ -3986,6 +4100,7 @@ void help(void) + #endif +@@ -4623,6 +4720,7 @@ void help(void) #if defined(TARGET_PPC) || defined(TARGET_SPARC) "-g WxH[xDEPTH] Set the initial graphical resolution and depth\n" #endif + "-nic-pcnet simulate an AMD PC-Net PCI ethernet adaptor\n" "\n" "Network options:\n" - "-net nic[,vlan=n][,macaddr=addr]\n" -@@ -4093,6 +4208,7 @@ enum { + "-net nic[,vlan=n][,macaddr=addr][,model=type]\n" +@@ -4735,6 +4833,7 @@ enum { QEMU_OPTION_audio_help, QEMU_OPTION_soundhw, #endif @@ -290,7 +206,7 @@ QEMU_OPTION_net, QEMU_OPTION_tftp, -@@ -4195,6 +4311,7 @@ const QEMUOption qemu_options[] = { +@@ -4841,6 +4940,7 @@ const QEMUOption qemu_options[] = { /* temporary options */ { "usb", 0, QEMU_OPTION_usb }, @@ -298,7 +214,7 @@ { "cirrusvga", 0, QEMU_OPTION_cirrusvga }, { NULL }, }; -@@ -4441,7 +4558,7 @@ int main(int argc, char **argv) +@@ -5101,7 +5201,7 @@ int main(int argc, char **argv) serial_devices[i][0] = '\0'; serial_device_index = 0; @@ -307,7 +223,7 @@ for(i = 1; i < MAX_PARALLEL_PORTS; i++) parallel_devices[i][0] = '\0'; parallel_device_index = 0; -@@ -4601,6 +4718,9 @@ int main(int argc, char **argv) +@@ -5261,6 +5361,9 @@ int main(int argc, char **argv) optarg); nb_net_clients++; break; diff --git a/emulators/qemu/patches/patch-vl_h b/emulators/qemu/patches/patch-vl_h index d7e3f7e7e89..92a6ba68ee9 100644 --- a/emulators/qemu/patches/patch-vl_h +++ b/emulators/qemu/patches/patch-vl_h @@ -1,8 +1,8 @@ -$OpenBSD: patch-vl_h,v 1.4 2006/04/10 21:10:05 todd Exp $ ---- vl.h.orig Mon Dec 19 16:51:53 2005 -+++ vl.h Mon Feb 20 21:37:31 2006 -@@ -91,8 +91,8 @@ int get_image_size(const char *filename) - int load_image(const char *filename, uint8_t *addr); +$OpenBSD: patch-vl_h,v 1.5 2006/06/08 14:33:38 todd Exp $ +--- vl.h.orig Wed May 3 15:32:58 2006 ++++ vl.h Fri May 5 22:07:42 2006 +@@ -96,8 +96,8 @@ void hw_error(const char *fmt, ...); + extern const char *bios_dir; -void pstrcpy(char *buf, int buf_size, const char *str); @@ -12,31 +12,7 @@ $OpenBSD: patch-vl_h,v 1.4 2006/04/10 21:10:05 todd Exp $ int strstart(const char *str, const char *val, const char **ptr); extern int vm_running; -@@ -279,6 +279,9 @@ typedef struct VLANClientState VLANClien - - struct VLANClientState { - IOReadHandler *fd_read; -+ /* Packets may still be sent if this returns zero. It's used to -+ rate-limit the slirp code. */ -+ IOCanRWHandler *fd_can_read; - void *opaque; - struct VLANClientState *next; - struct VLANState *vlan; -@@ -293,8 +296,12 @@ typedef struct VLANState { - - VLANState *qemu_find_vlan(int id); - VLANClientState *qemu_new_vlan_client(VLANState *vlan, -- IOReadHandler *fd_read, void *opaque); -+ IOReadHandler *fd_read, -+ IOCanRWHandler *fd_can_read, -+ void *opaque); -+int qemu_can_send_packet(VLANClientState *vc); - void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size); -+void qemu_handler_true(void *opaque); - - void do_info_network(void); - -@@ -728,6 +735,12 @@ int fdctrl_get_drive_type(fdctrl_t *fdct +@@ -769,6 +769,12 @@ int fdctrl_get_drive_type(fdctrl_t *fdct void isa_ne2000_init(int base, int irq, NICInfo *nd); void pci_ne2000_init(PCIBus *bus, NICInfo *nd); @@ -47,5 +23,5 @@ $OpenBSD: patch-vl_h,v 1.4 2006/04/10 21:10:05 todd Exp $ + +void pci_pcnet_init(PCIBus *bus, NICInfo *nd); - /* pckbd.c */ + /* rtl8139.c */ diff --git a/emulators/qemu/patches/patch-vnc_c b/emulators/qemu/patches/patch-vnc_c new file mode 100644 index 00000000000..8dfbbc0bfd3 --- /dev/null +++ b/emulators/qemu/patches/patch-vnc_c @@ -0,0 +1,294 @@ +$OpenBSD: patch-vnc_c,v 1.1 2006/06/08 14:33:38 todd Exp $ +--- vnc.c.orig Wed May 3 15:32:58 2006 ++++ vnc.c Fri May 12 18:46:20 2006 +@@ -42,6 +42,14 @@ typedef struct VncState VncState; + + typedef int VncReadEvent(VncState *vs, char *data, size_t len); + ++typedef void VncWritePixels(VncState *vs, void *data, int size); ++ ++typedef void VncSendHextileTile(VncState *vs, ++ int x, int y, int w, int h, ++ uint32_t *last_bg, ++ uint32_t *last_fg, ++ int *has_bg, int *has_fg); ++ + struct VncState + { + QEMUTimer *timer; +@@ -53,12 +61,19 @@ struct VncState + int height; + uint64_t dirty_row[768]; + char *old_data; +- int depth; ++ int depth; /* internal VNC frame buffer byte per pixel */ + int has_resize; + int has_hextile; + Buffer output; + Buffer input; + kbd_layout_t *kbd_layout; ++ /* current output mode information */ ++ VncWritePixels *write_pixels; ++ VncSendHextileTile *send_hextile_tile; ++ int pix_bpp, pix_big_endian; ++ int red_shift, red_max, red_shift1; ++ int green_shift, green_max, green_shift1; ++ int blue_shift, blue_max, blue_shift1; + + VncReadEvent *read_handler; + size_t read_handler_expect; +@@ -130,6 +145,66 @@ static void vnc_dpy_resize(DisplayState + } + } + ++/* fastest code */ ++static void vnc_write_pixels_copy(VncState *vs, void *pixels, int size) ++{ ++ vnc_write(vs, pixels, size); ++} ++ ++/* slowest but generic code. */ ++static void vnc_convert_pixel(VncState *vs, uint8_t *buf, uint32_t v) ++{ ++ unsigned int r, g, b; ++ ++ r = (v >> vs->red_shift1) & vs->red_max; ++ g = (v >> vs->green_shift1) & vs->green_max; ++ b = (v >> vs->blue_shift1) & vs->blue_max; ++ v = (r << vs->red_shift) | ++ (g << vs->green_shift) | ++ (b << vs->blue_shift); ++ switch(vs->pix_bpp) { ++ case 1: ++ buf[0] = v; ++ break; ++ case 2: ++ if (vs->pix_big_endian) { ++ buf[0] = v >> 8; ++ buf[1] = v; ++ } else { ++ buf[1] = v >> 8; ++ buf[0] = v; ++ } ++ break; ++ default: ++ case 4: ++ if (vs->pix_big_endian) { ++ buf[0] = v >> 24; ++ buf[1] = v >> 16; ++ buf[2] = v >> 8; ++ buf[3] = v; ++ } else { ++ buf[3] = v >> 24; ++ buf[2] = v >> 16; ++ buf[1] = v >> 8; ++ buf[0] = v; ++ } ++ break; ++ } ++} ++ ++static void vnc_write_pixels_generic(VncState *vs, void *pixels1, int size) ++{ ++ uint32_t *pixels = pixels1; ++ uint8_t buf[4]; ++ int n, i; ++ ++ n = size >> 2; ++ for(i = 0; i < n; i++) { ++ vnc_convert_pixel(vs, buf, pixels[i]); ++ vnc_write(vs, buf, vs->pix_bpp); ++ } ++} ++ + static void send_framebuffer_update_raw(VncState *vs, int x, int y, int w, int h) + { + int i; +@@ -139,7 +214,7 @@ static void send_framebuffer_update_raw( + + row = vs->ds->data + y * vs->ds->linesize + x * vs->depth; + for (i = 0; i < h; i++) { +- vnc_write(vs, row, w * vs->depth); ++ vs->write_pixels(vs, row, w * vs->depth); + row += vs->ds->linesize; + } + } +@@ -162,35 +237,26 @@ static void hextile_enc_cord(uint8_t *pt + #include "vnchextile.h" + #undef BPP + ++#define GENERIC ++#define BPP 32 ++#include "vnchextile.h" ++#undef BPP ++#undef GENERIC ++ + static void send_framebuffer_update_hextile(VncState *vs, int x, int y, int w, int h) + { + int i, j; + int has_fg, has_bg; + uint32_t last_fg32, last_bg32; +- uint16_t last_fg16, last_bg16; +- uint8_t last_fg8, last_bg8; + + vnc_framebuffer_update(vs, x, y, w, h, 5); + + has_fg = has_bg = 0; + for (j = y; j < (y + h); j += 16) { + for (i = x; i < (x + w); i += 16) { +- switch (vs->depth) { +- case 1: +- send_hextile_tile_8(vs, i, j, MIN(16, x + w - i), MIN(16, y + h - j), +- &last_bg8, &last_fg8, &has_bg, &has_fg); +- break; +- case 2: +- send_hextile_tile_16(vs, i, j, MIN(16, x + w - i), MIN(16, y + h - j), +- &last_bg16, &last_fg16, &has_bg, &has_fg); +- break; +- case 4: +- send_hextile_tile_32(vs, i, j, MIN(16, x + w - i), MIN(16, y + h - j), ++ vs->send_hextile_tile(vs, i, j, ++ MIN(16, x + w - i), MIN(16, y + h - j), + &last_bg32, &last_fg32, &has_bg, &has_fg); +- break; +- default: +- break; +- } + } + } + } +@@ -660,31 +726,80 @@ static void set_encodings(VncState *vs, + } + } + ++static int compute_nbits(unsigned int val) ++{ ++ int n; ++ n = 0; ++ while (val != 0) { ++ n++; ++ val >>= 1; ++ } ++ return n; ++} ++ + static void set_pixel_format(VncState *vs, + int bits_per_pixel, int depth, + int big_endian_flag, int true_color_flag, + int red_max, int green_max, int blue_max, + int red_shift, int green_shift, int blue_shift) + { +- switch (bits_per_pixel) { +- case 32: +- case 24: ++ int host_big_endian_flag; ++ ++#ifdef WORDS_BIGENDIAN ++ host_big_endian_flag = 1; ++#else ++ host_big_endian_flag = 0; ++#endif ++ if (!true_color_flag) { ++ fail: ++ vnc_client_error(vs); ++ return; ++ } ++ if (bits_per_pixel == 32 && ++ host_big_endian_flag == big_endian_flag && ++ red_max == 0xff && green_max == 0xff && blue_max == 0xff && ++ red_shift == 16 && green_shift == 8 && blue_shift == 0) { + vs->depth = 4; +- break; +- case 16: ++ vs->write_pixels = vnc_write_pixels_copy; ++ vs->send_hextile_tile = send_hextile_tile_32; ++ } else ++ if (bits_per_pixel == 16 && ++ host_big_endian_flag == big_endian_flag && ++ red_max == 31 && green_max == 63 && blue_max == 31 && ++ red_shift == 11 && green_shift == 5 && blue_shift == 0) { + vs->depth = 2; +- break; +- case 8: ++ vs->write_pixels = vnc_write_pixels_copy; ++ vs->send_hextile_tile = send_hextile_tile_16; ++ } else ++ if (bits_per_pixel == 8 && ++ red_max == 7 && green_max == 7 && blue_max == 3 && ++ red_shift == 5 && green_shift == 2 && blue_shift == 0) { + vs->depth = 1; +- break; +- default: +- vnc_client_error(vs); +- break; ++ vs->write_pixels = vnc_write_pixels_copy; ++ vs->send_hextile_tile = send_hextile_tile_8; ++ } else ++ { ++ /* generic and slower case */ ++ if (bits_per_pixel != 8 && ++ bits_per_pixel != 16 && ++ bits_per_pixel != 32) ++ goto fail; ++ vs->depth = 4; ++ vs->red_shift = red_shift; ++ vs->red_max = red_max; ++ vs->red_shift1 = 24 - compute_nbits(red_max); ++ vs->green_shift = green_shift; ++ vs->green_max = green_max; ++ vs->green_shift1 = 16 - compute_nbits(green_max); ++ vs->blue_shift = blue_shift; ++ vs->blue_max = blue_max; ++ vs->blue_shift1 = 8 - compute_nbits(blue_max); ++ vs->pix_bpp = bits_per_pixel / 8; ++ vs->pix_big_endian = big_endian_flag; ++ vs->write_pixels = vnc_write_pixels_generic; ++ vs->send_hextile_tile = send_hextile_tile_generic; + } + +- if (!true_color_flag) +- vnc_client_error(vs); +- + vnc_dpy_resize(vs->ds, vs->ds->width, vs->ds->height); + memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row)); + memset(vs->old_data, 42, vs->ds->linesize * vs->ds->height); +@@ -774,7 +889,11 @@ static int protocol_client_init(VncState + + vnc_write_u8(vs, vs->depth * 8); /* bits-per-pixel */ + vnc_write_u8(vs, vs->depth * 8); /* depth */ ++#ifdef WORDS_BIGENDIAN ++ vnc_write_u8(vs, 1); /* big-endian-flag */ ++#else + vnc_write_u8(vs, 0); /* big-endian-flag */ ++#endif + vnc_write_u8(vs, 1); /* true-color-flag */ + if (vs->depth == 4) { + vnc_write_u16(vs, 0xFF); /* red-max */ +@@ -783,6 +902,7 @@ static int protocol_client_init(VncState + vnc_write_u8(vs, 16); /* red-shift */ + vnc_write_u8(vs, 8); /* green-shift */ + vnc_write_u8(vs, 0); /* blue-shift */ ++ vs->send_hextile_tile = send_hextile_tile_32; + } else if (vs->depth == 2) { + vnc_write_u16(vs, 31); /* red-max */ + vnc_write_u16(vs, 63); /* green-max */ +@@ -790,14 +910,18 @@ static int protocol_client_init(VncState + vnc_write_u8(vs, 11); /* red-shift */ + vnc_write_u8(vs, 5); /* green-shift */ + vnc_write_u8(vs, 0); /* blue-shift */ ++ vs->send_hextile_tile = send_hextile_tile_16; + } else if (vs->depth == 1) { +- vnc_write_u16(vs, 3); /* red-max */ ++ /* XXX: change QEMU pixel 8 bit pixel format to match the VNC one ? */ ++ vnc_write_u16(vs, 7); /* red-max */ + vnc_write_u16(vs, 7); /* green-max */ + vnc_write_u16(vs, 3); /* blue-max */ + vnc_write_u8(vs, 5); /* red-shift */ + vnc_write_u8(vs, 2); /* green-shift */ + vnc_write_u8(vs, 0); /* blue-shift */ ++ vs->send_hextile_tile = send_hextile_tile_8; + } ++ vs->write_pixels = vnc_write_pixels_copy; + + vnc_write(vs, pad, 3); /* padding */ + diff --git a/emulators/qemu/patches/patch-vnchextile_h b/emulators/qemu/patches/patch-vnchextile_h new file mode 100644 index 00000000000..e7880745b86 --- /dev/null +++ b/emulators/qemu/patches/patch-vnchextile_h @@ -0,0 +1,92 @@ +$OpenBSD: patch-vnchextile_h,v 1.1 2006/06/08 14:33:38 todd Exp $ +--- vnchextile.h.orig Wed May 3 15:32:58 2006 ++++ vnchextile.h Fri May 12 18:46:20 2006 +@@ -1,15 +1,23 @@ + #define CONCAT_I(a, b) a ## b + #define CONCAT(a, b) CONCAT_I(a, b) + #define pixel_t CONCAT(uint, CONCAT(BPP, _t)) ++#ifdef GENERIC ++#define NAME generic ++#else ++#define NAME BPP ++#endif + +-static void CONCAT(send_hextile_tile_, BPP)(VncState *vs, ++static void CONCAT(send_hextile_tile_, NAME)(VncState *vs, + int x, int y, int w, int h, +- pixel_t *last_bg, pixel_t *last_fg, ++ uint32_t *last_bg32, ++ uint32_t *last_fg32, + int *has_bg, int *has_fg) + { + char *row = (vs->ds->data + y * vs->ds->linesize + x * vs->depth); + pixel_t *irow = (pixel_t *)row; + int j, i; ++ pixel_t *last_bg = (pixel_t *)last_bg32; ++ pixel_t *last_fg = (pixel_t *)last_fg32; + pixel_t bg = 0; + pixel_t fg = 0; + int n_colors = 0; +@@ -122,10 +130,15 @@ static void CONCAT(send_hextile_tile_, B + has_color = 1; + } else if (irow[i] != color) { + has_color = 0; +- ++#ifdef GENERIC ++ vnc_convert_pixel(vs, data + n_data, color); ++ n_data += vs->pix_bpp; ++#else + memcpy(data + n_data, &color, sizeof(color)); +- hextile_enc_cord(data + n_data + sizeof(pixel_t), min_x, j, i - min_x, 1); +- n_data += 2 + sizeof(pixel_t); ++ n_data += sizeof(pixel_t); ++#endif ++ hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1); ++ n_data += 2; + n_subtiles++; + + min_x = -1; +@@ -137,9 +150,15 @@ static void CONCAT(send_hextile_tile_, B + } + } + if (has_color) { ++#ifdef GENERIC ++ vnc_convert_pixel(vs, data + n_data, color); ++ n_data += vs->pix_bpp; ++#else + memcpy(data + n_data, &color, sizeof(color)); +- hextile_enc_cord(data + n_data + sizeof(pixel_t), min_x, j, i - min_x, 1); +- n_data += 2 + sizeof(pixel_t); ++ n_data += sizeof(pixel_t); ++#endif ++ hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1); ++ n_data += 2; + n_subtiles++; + } + irow += vs->ds->linesize / sizeof(pixel_t); +@@ -169,21 +188,22 @@ static void CONCAT(send_hextile_tile_, B + vnc_write_u8(vs, flags); + if (n_colors < 4) { + if (flags & 0x02) +- vnc_write(vs, last_bg, sizeof(pixel_t)); ++ vs->write_pixels(vs, last_bg, sizeof(pixel_t)); + if (flags & 0x04) +- vnc_write(vs, last_fg, sizeof(pixel_t)); ++ vs->write_pixels(vs, last_fg, sizeof(pixel_t)); + if (n_subtiles) { + vnc_write_u8(vs, n_subtiles); + vnc_write(vs, data, n_data); + } + } else { + for (j = 0; j < h; j++) { +- vnc_write(vs, row, w * vs->depth); ++ vs->write_pixels(vs, row, w * vs->depth); + row += vs->ds->linesize; + } + } + } + ++#undef NAME + #undef pixel_t + #undef CONCAT_I + #undef CONCAT diff --git a/emulators/qemu/pkg/PLIST b/emulators/qemu/pkg/PLIST index 209b1bf674e..117aec3f194 100644 --- a/emulators/qemu/pkg/PLIST +++ b/emulators/qemu/pkg/PLIST @@ -1,8 +1,9 @@ -@comment $OpenBSD: PLIST,v 1.5 2006/02/17 12:43:32 todd Exp $ +@comment $OpenBSD: PLIST,v 1.6 2006/06/08 14:33:38 todd Exp $ bin/qemu bin/qemu-img bin/qemu-system-arm bin/qemu-system-mips +bin/qemu-system-mipsel bin/qemu-system-ppc bin/qemu-system-sparc bin/qemu-system-x86_64