o update to 0.9.1, lots from brad@

o see http://qemu.org/changelog.html for details
o see README.OpenBSD for an intro to qemu on OpenBSD
o disable broken arm host support for now
This commit is contained in:
todd 2008-04-28 22:52:38 +00:00
parent d3c9529769
commit 2feda3c1f5
32 changed files with 517 additions and 544 deletions

View File

@ -1,19 +1,18 @@
# $OpenBSD: Makefile,v 1.31 2008/04/01 08:51:18 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.32 2008/04/28 22:52:38 todd Exp $
# no success building on other archs yet
ONLY_FOR_ARCHS= amd64 arm i386 powerpc
ONLY_FOR_ARCHS= amd64 i386 powerpc
COMMENT= multi system emulator
DISTNAME= qemu-0.9.0
PKGNAME= ${DISTNAME}p5
DISTNAME= qemu-0.9.1
CATEGORIES= emulators
HOMEPAGE= http://fabrice.bellard.free.fr/qemu/
MAINTAINER= Todd T. Fries <todd@openbsd.org>
# GPLv2 - LGPL
# GPLv2/LGPLv2/BSD
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
@ -23,8 +22,10 @@ MASTER_SITES= ${HOMEPAGE}
BUILD_DEPENDS= ::textproc/texi2html
USE_GMAKE= Yes
WANTLIB= m z ossaudio c
CONFIGURE_STYLE= gnu
WANTLIB= c m ossaudio z
CONFIGURE_STYLE= simple
CONFIGURE_ARGS+= --prefix=${PREFIX} \
--disable-vnc-tls
# Currently, the regression tests are utterly broken.
REGRESS_TARGET= test test2
@ -36,17 +37,14 @@ PATCH_LIST= patch-* misc-*
FLAVORS= no_x11
FLAVOR?=
CONFIGURE_ENV+= USE_KQEMU=yes
.if ${FLAVOR:L:Mno_x11}
CONFIGURE_ARGS+= --disable-gfx-check \
--disable-sdl
.else
LIB_DEPENDS= SDL::devel/sdl \
aa::graphics/aalib
LIB_DEPENDS= SDL::devel/sdl
USE_X11= Yes
WANTLIB+= X11 Xext pthread usbhid
WANTLIB+= pthread
.endif
pre-configure:
@ -55,5 +53,8 @@ pre-configure:
post-install:
@${INSTALL_DATA_DIR} ${PREFIX}/share/examples/qemu
@${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifup ${PREFIX}/share/examples/qemu
@${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifdown ${PREFIX}/share/examples/qemu
@${INSTALL_DATA_DIR} ${PREFIX}/share/doc/qemu
@${INSTALL_SCRIPT} ${FILESDIR}/README.OpenBSD ${PREFIX}/share/doc/qemu
.include <bsd.port.mk>

View File

@ -1,5 +1,5 @@
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
MD5 (qemu-0.9.1.tar.gz) = ZZHfjpJw6zWMiB3k6+oSYg==
RMD160 (qemu-0.9.1.tar.gz) = 7nvbVaRUDfIILUvenr/S9ObyAaU=
SHA1 (qemu-0.9.1.tar.gz) = Yw6iC1mJ8N8AEo3n975mHFc+0EE=
SHA256 (qemu-0.9.1.tar.gz) = R1bQtKTcfdiDVLxrN9OB5EYt0yjQ/u+UgD6QwEVYNaU=
SIZE (qemu-0.9.1.tar.gz) = 2804104

View File

@ -0,0 +1,176 @@
README for OpenBSD users
------------------------
==> Quick Start
1. get a bootable floppy image
2. qemu-img create -f qcow2 virtual.hd 10G
3. qemu -m 32 -fda floppy.fs -boot a -monitor stdio virtual.hd
(initial install to hard drive)
4. qemu-img convert -c -O qcow2 virtual.hd tmp && mv tmp virtual.hd
(compress hard drive while qemu is not running)
5. qemu -m 32 -monitor stdio virtual.hd
(normal boot from hard drive)
==> Networking
1. Default Settings
By default, qemu sets up the equivalent of the following networking:
-net nic,vlan=0,model=ne2k_pci,macaddr=52:54:00:12:34:56
-net user,vlan=0
Also, inside this virtual usermode network, it uses the 10.0.2.0/24 and
serves dhcp from inside this virtual network. Static address can be used
if one cannot or does not want to do dhcp in the guest os:
Guest OS IP : 10.0.2.15
Default Gateway : 10.0.2.2
Nameserver : 10.0.2.3
It is sufficient for most operations, qemu itself performs NAT and then
makes userland network calls for tcp/udp operations. icmp and other things
are not possible in this mode.
It is recommended to use this if at all possible, because other options
involve running qemu as root.
Note: If you use one '-net' cmdline argument, qemu assumes you know what you
want and clears defaults for the rest of the -net defaults.
Note: The guest mode networking does not currently support IPv6, and
qemu will complain that it cannot find a dns server if /etc/resolv.conf
contains only IPv6 dns servers.
2. tap mode
Sometimes it is desirable to configure qemu to access a network via layer2
directly. This has the side effect that currently it requires root
privileges to open and configure /dev/tunN. There is no way to drop from
root privileges at this point.
%SYSCONFDIR%/qemu-ifup contains some default settings that permit one to do
the following:
# qemu -net nic -net tap virtual.hd
It presumes you have a 'trunk0' interface you wish the tun(4) interface to
talk to. It presumes you want 'bridge0' to be used to bridge the two.
If you wish to over-ride these settings, setting the environment variables
ETHER and BRIDGE will over-ride these settings, respectively.
When starting qemu, the script attempts to output useful information, but
there are also error messages that occur as well. On my laptop, I want to
route / nat natively using pf and also have layer2 access to the qemu
networks. I thus have this as /etc/hostname.trunk101:
inet6 fe80::1c 64 lladdr 00:03:25:0d:7a:2c
inet 10.7.255.1 255.255.255.0
inet6 alias 2001:240:58a:45::1c
I have dhcpd configured to run on trunk101, and also run rtadvd. For qemu,
the startup looks like this:
# export ETHER=trunk101
# export BRIDGE=bridge101
# qemu -net nic,vlan=0,model=rtl8139,macaddr=52:54:00:12:35:00 \
-net tap,vlan=0 -vnc :0 -localtime -usb -usbdevice tablet \
-m 256 -hda virtual.hd -monitor stdio
{tun0 (bridge101 <-> trunk101)brconfig: bridge101: No such process
brconfig: bridge101: No such process
}
(qemu)
The errors are normal and should be ignored. One can verify the networking
is properly configured by verifying the bridge interface:
$ brconfig bridge101
bridge101: flags=41<UP,RUNNING>
priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp
designated: id 00:00:00:00:00:00 priority 0
tun0 flags=3<LEARNING,DISCOVER>
port 16 ifpriority 0 ifcost 0
trunk101 flags=3<LEARNING,DISCOVER>
port 6 ifpriority 0 ifcost 0
Addresses (max cache: 100, timeout: 240):
Note: when running multiple qemu sessions simultaneously on the same bridge,
care must be taken because the network mac address defaults
to 52:54:00:12:34:56 for every qemu instance. To change this, observe
the macaddr= syntax in the above example.
==> Mice
Note: Certain m$ os's work so much better with the tablet usb device than
the normal ps2 mouse handling. See the above example for usage.
==> Serial Console
1. Installing OpenBSD via serial console is sometimes desirable. X may not
be available, and so on. There are two ways to accomplish this, both in
effect the same solution:
a. qemu -vnc :0 -serial stdio .. virtual.hd -cdrom install43.iso -boot d
- this option permits you to use vnc from some system to connect to
the qemu instance and 'set tty com0' at the 'boot>' prompt.
- you may then disconnect vnc and use the terminal from which you
started qemu to do the install
b. qemu -nographic .. virtual.hd -fda floppy43.fs -boot a
- this maps both the serial port and the (qemu) monitor prompt to
the terminal qemu was started on
- to flip between them, Ctrl-a c; see the qemu man page for other
commands that work in -nographic mode.
- preparation of the floppy image to force serial console mode is
straightforward:
vnconfig svnd0 floppy43.fs
mount /dev/svnd0c /mnt
mkdir /mnt/etc
echo set tty com0 > /mnt/etc/boot.conf
umount /mnt
vnconfig -u svnd0
.. be sure to choose 'yes' for setting com0 to be the serial console.
Note: OpenBSD poweroff does work with qemu, which actually causes qemu
itself to exit. This is a good thing, as it is currently not possible to
set what block device is booted from at runtime from qemu. So if you start
an installation booting from a cdrom, you will always boot off a cdrom
every time you reboot that qemu session until you exit and start qemu
again booting off the virtual hard drive.
==> daemonized qemu
Sometimes you want qemu to start as part of a system script.
Adding to some of the above, the -daemonize option comes in handy,
as well as the telnet: designator for -serial and monitor. This
is a complete example that may be cut-and-pasted into rc.local:
hddir=/var/vm
if [ -x /usr/local/bin/qemu ]; then
echo -n 'Qemu: vmi386'
(
export ETHER=trunk101
export BRIDGE=bridge101
/usr/local/bin/qemu \
-daemonize \
-nographic \
-net nic,vlan=0,model=rtl8139,macaddr=52:54:00:4e:62:8f \
-net tap,vlan=0 \
-m 128 \
-hda $hddir/vmi386.hd \
-serial telnet:127.0.0.1:1010,server,nowait \
-monitor telnet:127.0.0.1:1011,server,nowait
)
echo "."
fi

View File

@ -0,0 +1,14 @@
#! /bin/sh
_ETHER=trunk0
_BRIDGE=bridge0
# Let the environment over-ride this
[ "$BRIDGE" ] || BRIDGE=${_BRIDGE}
[ "$ETHER" ] || ETHER=${_ETHER}
if test `id -u` -ne 0; then
SUDO=sudo
fi
$SUDO brconfig $brif del $1 > /dev/null 2>&1

View File

@ -1,11 +1,10 @@
$OpenBSD: misc-target-i386_helper_c,v 1.2 2008/01/19 23:53:58 todd Exp $
--- target-i386/helper.c.orig Mon Feb 5 17:01:54 2007
+++ target-i386/helper.c Wed Jan 16 11:22:08 2008
@@ -3838,3 +3838,13 @@ void tlb_fill(target_ulong addr, int is_write, int is_
}
$OpenBSD: misc-target-i386_helper_c,v 1.3 2008/04/28 22:52:38 todd Exp $
--- target-i386/helper.c.orig Sun Jan 6 14:38:45 2008
+++ target-i386/helper.c Wed Apr 2 01:43:09 2008
@@ -3954,6 +3954,16 @@ void tlb_fill(target_ulong addr, int is_write, int mmu
env = saved_env;
}
+
+void helper_fchs_ST0(void)
+{
+ ST0 = floatx_chs(ST0);
@ -15,3 +14,7 @@ $OpenBSD: misc-target-i386_helper_c,v 1.2 2008/01/19 23:53:58 todd Exp $
+{
+ ST0 = floatx_abs(ST0);
+}
+
/* Secure Virtual Machine helpers */

View File

@ -1,7 +1,7 @@
$OpenBSD: misc-target-i386_op_c,v 1.2 2008/01/19 23:53:58 todd Exp $
--- target-i386/op.c.orig Mon Feb 5 17:01:54 2007
+++ target-i386/op.c Wed Jan 16 11:22:08 2008
@@ -2164,12 +2164,12 @@ void OPPROTO op_fdivr_STN_ST0(void)
$OpenBSD: misc-target-i386_op_c,v 1.3 2008/04/28 22:52:38 todd Exp $
--- target-i386/op.c.orig Sun Jan 6 14:38:45 2008
+++ target-i386/op.c Wed Apr 2 01:43:10 2008
@@ -2214,12 +2214,12 @@ void OPPROTO op_fdivr_STN_ST0(void)
/* misc FPU operations */
void OPPROTO op_fchs_ST0(void)
{

View File

@ -1,17 +1,8 @@
$OpenBSD: patch-Makefile,v 1.6 2007/05/01 12:55:14 todd Exp $
--- 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 *~ */*~
$OpenBSD: patch-Makefile,v 1.7 2008/04/28 22:52:38 todd Exp $
--- Makefile.orig Sun Jan 6 14:38:41 2008
+++ Makefile Tue Apr 1 01:33:38 2008
@@ -149,7 +149,7 @@ clean:
rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d
$(MAKE) -C tests clean
for d in $(TARGET_DIRS); do \
- $(MAKE) -C $$d $@ || exit 1 ; \
@ -19,7 +10,7 @@ $OpenBSD: patch-Makefile,v 1.6 2007/05/01 12:55:14 todd Exp $
done
distclean: clean
@@ -106,7 +106,7 @@ cscope:
@@ -206,7 +206,7 @@ cscope:
# documentation
%.html: %.texi

View File

@ -1,7 +1,24 @@
$OpenBSD: patch-Makefile_target,v 1.11 2007/05/01 12:55:14 todd Exp $
--- 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
$OpenBSD: patch-Makefile_target,v 1.12 2008/04/28 22:52:38 todd Exp $
--- Makefile.target.orig Sun Jan 6 14:38:41 2008
+++ Makefile.target Wed Apr 9 23:28:03 2008
@@ -136,11 +136,11 @@ endif
endif
endif
-ifeq ($(ARCH),x86_64)
- ifneq ($(CONFIG_SOLARIS),yes)
- BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
- endif
-endif
+#ifeq ($(ARCH),x86_64)
+# ifneq ($(CONFIG_SOLARIS),yes)
+# BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
+# endif
+#endif
ifeq ($(ARCH),ppc)
CPPFLAGS+= -D__powerpc__
@@ -188,7 +188,7 @@ BASE_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
endif
ifeq ($(ARCH),arm)
@ -10,8 +27,8 @@ $OpenBSD: patch-Makefile_target,v 1.11 2007/05/01 12:55:14 todd Exp $
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
endif
@@ -163,6 +163,12 @@ ifeq ($(ARCH),mips)
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
@@ -215,6 +215,16 @@ BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
endif
endif
+# Very important for this 'ifeq' block to be after other
@ -20,10 +37,14 @@ $OpenBSD: patch-Makefile_target,v 1.11 2007/05/01 12:55:14 todd Exp $
+OP_CFLAGS+= -fno-stack-protector
+endif
+
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
@@ -182,6 +188,7 @@ OP_CFLAGS+=$(OS_CFLAGS)
+ifdef CONFIG_OSS_LIBRARY
+LIBS+=-lossaudio
+endif
+
ifeq ($(CONFIG_DARWIN),yes)
LIBS+=-lmx
endif
@@ -232,6 +242,7 @@ OP_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
#########################################################
CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
@ -31,22 +52,31 @@ $OpenBSD: patch-Makefile_target,v 1.11 2007/05/01 12:55:14 todd Exp $
LIBS+=-lm
ifndef CONFIG_USER_ONLY
LIBS+=-lz
@@ -329,6 +336,9 @@ endif
SOUND_HW = sb16.o es1370.o
AUDIODRV = audio.o noaudio.o wavaudio.o
+ifdef CONFIG_OSS_LIBRARY
+LIBS += -lossaudio
+endif
ifdef CONFIG_SDL
AUDIODRV += sdlaudio.o
endif
@@ -440,7 +450,7 @@ endif
@@ -537,7 +548,7 @@ endif
ifndef CONFIG_DARWIN
ifndef CONFIG_WIN32
ifndef CONFIG_SOLARIS
-VL_LIBS=-lutil -lrt
+#VL_LIBS=-lutil -lrt
-VL_LIBS+=-lutil
+#VL_LIBS+=-lutil
endif
endif
endif
@@ -557,12 +568,12 @@ ifeq ($(ARCH),sparc64)
endif
endif
-ifeq ($(ARCH),x86_64)
- VL_LDFLAGS+=-m64
- ifneq ($(CONFIG_SOLARIS),yes)
- VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
- endif
-endif
+#ifeq ($(ARCH),x86_64)
+# VL_LDFLAGS+=-m64
+# ifneq ($(CONFIG_SOLARIS),yes)
+# VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
+# endif
+#endif
ifdef CONFIG_WIN32
SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole

View File

@ -1,19 +0,0 @@
$OpenBSD: patch-audio_ossaudio_c,v 1.3 2007/05/01 12:55:14 todd Exp $
--- 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.
*/
+#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/ioctl.h>
+#ifdef __OpenBSD__
+#include <soundcard.h>
+#else
#include <sys/soundcard.h>
+#endif
#include "vl.h"
#define AUDIO_CAP "oss"

View File

@ -1,27 +0,0 @@
$OpenBSD: patch-block-qcow2_c,v 1.1 2007/05/01 12:55:14 todd Exp $
--- 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);

View File

@ -1,35 +1,29 @@
$OpenBSD: patch-block-raw_c,v 1.1 2007/05/01 12:55:14 todd Exp $
--- 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 @@
$OpenBSD: patch-block-raw-posix_c,v 1.1 2008/04/28 22:52:38 todd Exp $
--- block-raw-posix.c.orig Sun Jan 6 14:38:42 2008
+++ block-raw-posix.c Tue Apr 1 22:38:47 2008
@@ -28,7 +28,9 @@
#endif
#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__)
#ifdef CONFIG_COCOA
#include <paths.h>
@@ -55,6 +57,11 @@
#ifdef __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
@@ -231,6 +238,7 @@ label__raw_write__success:
}
/***********************************************************/
@ -37,7 +31,7 @@ $OpenBSD: patch-block-raw_c,v 1.1 2007/05/01 12:55:14 todd Exp $
/* Unix AIO using POSIX AIO */
typedef struct RawAIOCB {
@@ -380,6 +389,37 @@ static void raw_aio_cancel(BlockDriverAIOCB *blockacb)
@@ -456,6 +464,37 @@ static void raw_aio_cancel(BlockDriverAIOCB *blockacb)
}
}
@ -61,8 +55,8 @@ $OpenBSD: patch-block-raw_c,v 1.1 2007/05/01 12:55:14 todd Exp $
+
+void qemu_aio_wait(void)
+{
+#ifndef QEMU_TOOL
+ qemu_bh_poll();
+#ifndef QEMU_IMG
+ qemu_bh_poll();
+#endif
+}
+
@ -75,25 +69,25 @@ $OpenBSD: patch-block-raw_c,v 1.1 2007/05/01 12:55:14 todd Exp $
static void raw_close(BlockDriverState *bs)
{
BDRVRawState *s = bs->opaque;
@@ -399,8 +439,25 @@ static int raw_truncate(BlockDriverState *bs, int64_t
@@ -475,8 +514,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;
+ 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)
@ -101,7 +95,7 @@ $OpenBSD: patch-block-raw_c,v 1.1 2007/05/01 12:55:14 todd Exp $
BDRVRawState *s = bs->opaque;
int fd = s->fd;
int64_t size;
@@ -445,6 +502,7 @@ static int64_t raw_getlength(BlockDriverState *bs)
@@ -521,6 +577,7 @@ static int64_t raw_getlength(BlockDriverState *bs)
}
return size;
}
@ -109,33 +103,31 @@ $OpenBSD: patch-block-raw_c,v 1.1 2007/05/01 12:55:14 todd Exp $
static int raw_create(const char *filename, int64_t total_size,
const char *backing_file, int flags)
@@ -479,11 +537,13 @@ BlockDriver bdrv_raw = {
@@ -555,11 +612,12 @@ 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 */
+#endif
.protocol_name = "file",
.bdrv_pread = raw_pread,
.bdrv_pwrite = raw_pwrite,
@@ -815,11 +875,13 @@ BlockDriver bdrv_host_device = {
@@ -907,11 +965,12 @@ 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 */
+#endif
.bdrv_pread = raw_pread,
.bdrv_pwrite = raw_pwrite,
.bdrv_getlength = raw_getlength,

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-configure,v 1.9 2008/01/19 23:53:58 todd Exp $
--- configure.orig Mon Feb 5 17:01:54 2007
+++ configure Wed Jan 16 11:23:08 2008
$OpenBSD: patch-configure,v 1.10 2008/04/28 22:52:38 todd Exp $
--- configure.orig Sun Jan 6 14:38:42 2008
+++ configure Thu Apr 10 01:34:20 2008
@@ -21,10 +21,10 @@ prefix=""
interp_prefix="/usr/gnemul/qemu-%M"
static="no"
@ -8,7 +8,7 @@ $OpenBSD: patch-configure,v 1.9 2008/01/19 23:53:58 todd Exp $
-cc="gcc"
+cc="${CC:-cc}"
gcc3_search="yes"
gcc3_list="gcc-3.4 gcc34 gcc-3.3 gcc33 gcc-3.2 gcc32"
gcc3_list="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
-host_cc="gcc"
+host_cc="${CC:-cc}"
ar="ar"
@ -23,7 +23,7 @@ $OpenBSD: patch-configure,v 1.9 2008/01/19 23:53:58 todd Exp $
cpu="powerpc"
;;
mips)
@@ -68,6 +68,9 @@ case "$cpu" in
@@ -74,6 +74,9 @@ case "$cpu" in
x86_64|amd64)
cpu="x86_64"
;;
@ -33,28 +33,37 @@ $OpenBSD: patch-configure,v 1.9 2008/01/19 23:53:58 todd Exp $
*)
cpu="unknown"
;;
@@ -122,7 +125,11 @@ oss="yes"
@@ -142,7 +145,11 @@ oss="yes"
;;
OpenBSD)
bsd="yes"
+openbsd="yes"
oss="yes"
+if [ "$USE_KQEMU" = "yes" ] ; then
+if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
+ kqemu="yes"
+fi
;;
Darwin)
bsd="yes"
@@ -573,7 +580,7 @@ else
if test -z "$prefix" ; then
prefix="/usr/local"
@@ -329,7 +336,7 @@ else
fi
-mandir="$prefix/share/man"
+mandir="$prefix/man"
datadir="$prefix/share/qemu"
docdir="$prefix/share/doc/qemu"
bindir="$prefix/bin"
@@ -601,9 +608,7 @@ if test "$darwin" = "yes" ; then
# default flags for all hosts
-CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
+CFLAGS="$CFLAGS -Wall -g -fno-strict-aliasing"
LDFLAGS="$LDFLAGS -g"
if test "$werror" = "yes" ; then
CFLAGS="$CFLAGS -Werror"
@@ -680,7 +687,7 @@ else
if test -z "$prefix" ; then
prefix="/usr/local"
fi
- mansuffix="/share/man"
+ mansuffix="/man"
datasuffix="/share/qemu"
docsuffix="/share/doc/qemu"
binsuffix="/bin"
@@ -709,9 +716,7 @@ if test "$darwin" = "yes" ; then
echo "Cocoa support $cocoa"
fi
echo "SDL support $sdl"
@ -65,15 +74,15 @@ $OpenBSD: patch-configure,v 1.9 2008/01/19 23:53:58 todd Exp $
echo "mingw32 support $mingw32"
echo "Adlib support $adlib"
echo "CoreAudio support $coreaudio"
@@ -648,6 +653,7 @@ echo "mandir=$mandir" >> $config_mak
echo "datadir=$datadir" >> $config_mak
echo "docdir=$docdir" >> $config_mak
echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
@@ -772,6 +777,7 @@ echo "mandir=\${prefix}$mansuffix" >> $config_mak
echo "datadir=\${prefix}$datasuffix" >> $config_mak
echo "docdir=\${prefix}$docsuffix" >> $config_mak
echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $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 +673,9 @@ if test "$cpu" = "i386" ; then
@@ -793,6 +799,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
@ -83,7 +92,7 @@ $OpenBSD: patch-configure,v 1.9 2008/01/19 23:53:58 todd Exp $
elif test "$cpu" = "armv4b" ; then
echo "ARCH=arm" >> $config_mak
echo "#define HOST_ARM 1" >> $config_h
@@ -746,6 +755,9 @@ fi
@@ -892,6 +901,9 @@ fi
if test "$oss" = "yes" ; then
echo "CONFIG_OSS=yes" >> $config_mak
echo "#define CONFIG_OSS 1" >> $config_h
@ -93,9 +102,9 @@ $OpenBSD: patch-configure,v 1.9 2008/01/19 23:53:58 todd Exp $
fi
if test "$coreaudio" = "yes" ; then
echo "CONFIG_COREAUDIO=yes" >> $config_mak
@@ -777,6 +789,13 @@ echo "TARGET_DIRS=$target_list" >> $config_mak
if [ "$build_docs" = "yes" ] ; then
echo "BUILD_DOCS=yes" >> $config_mak
@@ -952,6 +964,13 @@ if test "$cocoa" = "yes" ; then
echo "#define CONFIG_COCOA 1" >> $config_h
echo "CONFIG_COCOA=yes" >> $config_mak
fi
+
+if [ "$openbsd" = "yes" ] ; then

View File

@ -1,13 +1,13 @@
$OpenBSD: patch-cpu-all_h,v 1.2 2007/05/01 12:55:14 todd Exp $
--- 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
$OpenBSD: patch-cpu-all_h,v 1.3 2008/04/28 22:52:38 todd Exp $
--- cpu-all.h.orig Sun Jan 6 14:38:42 2008
+++ cpu-all.h Tue Apr 1 01:43:57 2008
@@ -1008,13 +1008,22 @@ static inline int64_t cpu_get_real_ticks(void)
}
#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. */
- Just return a monotonically increasing value. This will be
- totally wrong, but hopefully better than nothing. */
+# warning non-optimized CPU
+#include <sys/time.h>
+#include <time.h>
@ -16,16 +16,16 @@ $OpenBSD: patch-cpu-all_h,v 1.2 2007/05/01 12:55:14 todd Exp $
{
- static int64_t ticks = 0;
- return ticks++;
+ struct timeval tv;
+ static int64_t i = 0;
+ int64_t j;
+
+ gettimeofday(&tv, NULL);
+ do {
+ j = (tv.tv_sec * (uint64_t) 1000000) + tv.tv_usec;
+ } while (i == j);
+ i = j;
+ return j;
+ struct timeval tv;
+ static int64_t i = 0;
+ int64_t j;
+
+ gettimeofday(&tv, NULL);
+ do {
+ j = (tv.tv_sec * (uint64_t) 1000000) + tv.tv_usec;
+ } while (i == j);
+ i = j;
+ return j;
}
#endif

View File

@ -1,9 +1,9 @@
$OpenBSD: patch-cutils_c,v 1.1 2007/05/01 12:55:14 todd Exp $
--- cutils.c.orig Mon Feb 5 17:01:54 2007
+++ cutils.c Tue Apr 3 08:21:27 2007
$OpenBSD: patch-cutils_c,v 1.2 2008/04/28 22:52:38 todd Exp $
--- cutils.c.orig Sun Jan 6 14:38:42 2008
+++ cutils.c Tue Apr 1 01:33:39 2008
@@ -23,7 +23,7 @@
*/
#include "vl.h"
#include "qemu-common.h"
-void pstrcpy(char *buf, int buf_size, const char *str)
+void pstrcpy(char *buf, size_t buf_size, const char *str)

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-dyngen-exec_h,v 1.5 2007/05/01 12:55:14 todd Exp $
--- dyngen-exec.h.orig Mon Feb 5 17:01:54 2007
+++ dyngen-exec.h Sat Mar 10 16:39:39 2007
$OpenBSD: patch-dyngen-exec_h,v 1.6 2008/04/28 22:52:38 todd Exp $
--- dyngen-exec.h.orig Sun Jan 6 14:38:42 2008
+++ dyngen-exec.h Tue Apr 1 01:40:00 2008
@@ -27,11 +27,15 @@
#define _FILEDEFED
#endif
@ -12,7 +12,7 @@ $OpenBSD: patch-dyngen-exec_h,v 1.5 2007/05/01 12:55:14 todd Exp $
host headers do not allow that. */
#include <stddef.h>
-
+#ifdef __OpenBSD__
+#ifdef _BSD
+#include <sys/types.h>
+#else
typedef unsigned char uint8_t;
@ -26,19 +26,17 @@ $OpenBSD: patch-dyngen-exec_h,v 1.5 2007/05/01 12:55:14 todd Exp $
/* 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))
+#ifdef __OpenBSD__
+typedef struct __sFILE FILE;
+#else
@@ -82,12 +87,12 @@ typedef void * host_reg_t;
typedef struct __sFILE FILE;
#else
typedef struct FILE FILE;
-#endif
extern int fprintf(FILE *, const char *, ...);
extern int fputs(const char *, FILE *);
extern int printf(const char *, ...);
#undef NULL
#define NULL 0
+#endif
#ifdef __i386__
#if defined(__i386__)
#define AREG0 "ebp"

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-exec_c,v 1.6 2007/05/01 12:55:14 todd Exp $
--- 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;
-
+
while (len > 0) {
page = addr & TARGET_PAGE_MASK;
l = (page + TARGET_PAGE_SIZE) - addr;

View File

@ -1,13 +1,13 @@
$OpenBSD: patch-fpu_softfloat-native_h,v 1.3 2007/05/01 12:55:14 todd Exp $
--- fpu/softfloat-native.h.orig Mon Feb 5 17:01:54 2007
+++ fpu/softfloat-native.h Sat Mar 10 16:39:40 2007
$OpenBSD: patch-fpu_softfloat-native_h,v 1.4 2008/04/28 22:52:38 todd Exp $
--- fpu/softfloat-native.h.orig Sun Jan 6 14:38:42 2008
+++ fpu/softfloat-native.h Tue Apr 1 01:33:39 2008
@@ -1,4 +1,5 @@
/* Native implementation of soft float functions */
+#include "gnu-c99-math.h"
#include <math.h>
#if (defined(_BSD) && !defined(__APPLE__)) || defined(HOST_SOLARIS)
@@ -61,6 +62,11 @@ typedef union {
@@ -84,6 +85,11 @@ typedef union {
| Software IEC/IEEE floating-point rounding mode.
*----------------------------------------------------------------------------*/
#if (defined(_BSD) && !defined(__APPLE__)) || defined(HOST_SOLARIS)

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-hw_ne2000_c,v 1.4 2007/05/01 12:55:14 todd Exp $
--- 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);

View File

@ -1,47 +0,0 @@
$OpenBSD: patch-hw_pc_c,v 1.6 2007/05/01 12:55:14 todd Exp $
--- 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,

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-hw_pckbd_c,v 1.1 2008/04/28 22:52:38 todd Exp $
--- hw/pckbd.c.orig Thu Apr 10 01:20:44 2008
+++ hw/pckbd.c Thu Apr 10 01:21:00 2008
@@ -211,7 +211,7 @@ static void kbd_write_command(void *opaque, uint32_t a
#endif
switch(val) {
case KBD_CCMD_READ_MODE:
- kbd_queue(s, s->mode, 1);
+ kbd_queue(s, s->mode, 0);
break;
case KBD_CCMD_WRITE_MODE:
case KBD_CCMD_WRITE_OBUF:

View File

@ -1,8 +1,8 @@
$OpenBSD: patch-hw_rtl8139_c,v 1.3 2008/03/31 06:49:27 todd Exp $
--- hw/rtl8139.c.orig Fri Mar 21 16:19:01 2008
+++ hw/rtl8139.c Fri Mar 21 16:19:18 2008
@@ -58,7 +58,7 @@
//#define RTL8139_CALCULATE_RXCRC 1
$OpenBSD: patch-hw_rtl8139_c,v 1.4 2008/04/28 22:52:38 todd Exp $
--- hw/rtl8139.c.orig Sun Jan 6 14:38:42 2008
+++ hw/rtl8139.c Tue Apr 1 01:33:39 2008
@@ -60,7 +60,7 @@
#define RTL8139_CALCULATE_RXCRC 1
/* Uncomment to enable on-board timer interrupts */
-//#define RTL8139_ONBOARD_TIMER 1

View File

@ -1,78 +0,0 @@
$OpenBSD: patch-monitor_c,v 1.1 2008/03/31 20:16:52 todd Exp $
--- monitor.c.orig Mon Mar 31 21:41:53 2008
+++ monitor.c Mon Mar 31 21:42:05 2008
@@ -362,6 +362,8 @@ static void do_eject(int force, const char *filename)
eject_device(bs, force);
}
+static int changing_rem_device;
+
static void do_change(const char *device, const char *filename)
{
BlockDriverState *bs;
@@ -377,6 +379,7 @@ static void do_change(const char *device, const char *
return;
bdrv_open(bs, filename, 0);
if (bdrv_is_encrypted(bs)) {
+ changing_rem_device=1;
term_printf("%s is encrypted.\n", device);
for(i = 0; i < 3; i++) {
monitor_readline("Password: ", 1, password, sizeof(password));
@@ -384,6 +387,7 @@ static void do_change(const char *device, const char *
break;
term_printf("invalid password\n");
}
+ changing_rem_device=0;
}
}
@@ -2441,6 +2445,8 @@ static void monitor_start_input(void)
readline_start("(qemu) ", 0, monitor_handle_command1, NULL);
}
+static int monitor_readline_started;
+
static void term_event(void *opaque, int event)
{
if (event != CHR_EVENT_RESET)
@@ -2449,7 +2455,8 @@ static void term_event(void *opaque, int event)
if (!hide_banner)
term_printf("QEMU %s monitor - type 'help' for more information\n",
QEMU_VERSION);
- monitor_start_input();
+ if (!monitor_readline_started)
+ monitor_start_input();
}
void monitor_init(CharDriverState *hd, int show_banner)
@@ -2462,7 +2469,6 @@ void monitor_init(CharDriverState *hd, int show_banner
/* XXX: use threads ? */
/* modal monitor readline */
-static int monitor_readline_started;
static char *monitor_readline_buf;
static int monitor_readline_buf_size;
@@ -2472,6 +2478,8 @@ static void monitor_readline_cb(void *opaque, const ch
monitor_readline_started = 0;
}
+void gui_update(void);
+
void monitor_readline(const char *prompt, int is_password,
char *buf, int buf_size)
{
@@ -2483,6 +2491,12 @@ void monitor_readline(const char *prompt, int is_passw
monitor_readline_buf_size = buf_size;
monitor_readline_started = 1;
while (monitor_readline_started) {
- main_loop_wait(10);
+ if (!changing_rem_device)
+ main_loop_wait(10);
+ else
+ gui_update();
}
+
+ if (!changing_rem_device)
+ monitor_start_input();
}

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-osdep_c,v 1.1 2008/01/19 23:53:58 todd Exp $
--- osdep.c.orig Mon Feb 5 17:01:54 2007
+++ osdep.c Mon Jan 7 19:01:42 2008
@@ -79,7 +79,14 @@ void qemu_vfree(void *ptr)
$OpenBSD: patch-osdep_c,v 1.2 2008/04/28 22:52:38 todd Exp $
--- osdep.c.orig Sun Jan 6 14:38:42 2008
+++ osdep.c Tue Apr 1 01:36:02 2008
@@ -83,7 +83,14 @@ void qemu_vfree(void *ptr)
#if defined(USE_KQEMU)
@ -16,7 +16,7 @@ $OpenBSD: patch-osdep_c,v 1.1 2008/01/19 23:53:58 todd Exp $
#include <sys/mman.h>
#include <fcntl.h>
@@ -87,9 +94,15 @@ void *kqemu_vmalloc(size_t size)
@@ -91,9 +98,15 @@ static void *kqemu_vmalloc(size_t size)
{
static int phys_ram_fd = -1;
static int phys_ram_size = 0;
@ -33,7 +33,7 @@ $OpenBSD: patch-osdep_c,v 1.1 2008/01/19 23:53:58 todd Exp $
#ifdef HOST_SOLARIS
struct statvfs stfs;
#else
@@ -151,11 +164,13 @@ void *kqemu_vmalloc(size_t size)
@@ -155,11 +168,13 @@ static void *kqemu_vmalloc(size_t size)
}
unlink(phys_ram_file);
}
@ -41,10 +41,10 @@ $OpenBSD: patch-osdep_c,v 1.1 2008/01/19 23:53:58 todd Exp $
+
size = (size + 4095) & ~4095;
ftruncate(phys_ram_fd, phys_ram_size + size);
ptr = mmap(NULL,
size,
- PROT_WRITE | PROT_READ, MAP_SHARED,
+ PROT_WRITE | PROT_READ, map_anon|MAP_SHARED,
ptr = mmap(NULL,
size,
- PROT_WRITE | PROT_READ, MAP_SHARED,
+ PROT_WRITE | PROT_READ, map_anon|MAP_SHARED,
phys_ram_fd, phys_ram_size);
if (ptr == MAP_FAILED) {
fprintf(stderr, "Could not map physical memory\n");

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-osdep_h,v 1.3 2007/05/01 12:55:14 todd Exp $
--- osdep.h.orig Mon Feb 5 17:01:54 2007
+++ osdep.h Sat Mar 10 16:39:40 2007
$OpenBSD: patch-osdep_h,v 1.4 2008/04/28 22:52:38 todd Exp $
--- osdep.h.orig Sun Jan 6 14:38:42 2008
+++ osdep.h Tue Apr 1 01:33:39 2008
@@ -2,6 +2,10 @@
#define QEMU_OSDEP_H
@ -10,5 +10,5 @@ $OpenBSD: patch-osdep_h,v 1.3 2007/05/01 12:55:14 todd Exp $
+#include <sys/signal.h>
+#endif
#define qemu_printf printf
#ifndef glue
#define xglue(x, y) x ## y

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-qemu-common_h,v 1.1 2008/04/28 22:52:38 todd Exp $
--- qemu-common.h.orig Tue Apr 1 01:45:33 2008
+++ qemu-common.h Tue Apr 1 01:45:59 2008
@@ -77,8 +77,8 @@ int qemu_bh_poll(void);
uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
/* 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);
time_t mktimegm(struct tm *tm);

View File

@ -1,17 +1,17 @@
$OpenBSD: patch-qemu-doc_texi,v 1.2 2008/03/31 14:26:00 todd Exp $
--- qemu-doc.texi.orig Tue Feb 6 00:01:54 2007
+++ qemu-doc.texi Sun Feb 10 02:32:12 2008
@@ -461,7 +461,7 @@ or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windo
Then @file{dir} can be accessed in @file{\\smbserver\qemu}.
$OpenBSD: patch-qemu-doc_texi,v 1.3 2008/04/28 22:52:38 todd Exp $
--- qemu-doc.texi.orig Sun Jan 6 14:38:42 2008
+++ qemu-doc.texi Tue Apr 1 01:33:39 2008
@@ -632,7 +632,7 @@ or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windo
Then @file{@var{dir}} can be accessed in @file{\\smbserver\qemu}.
Note that a SAMBA server must be installed on the host OS in
-@file{/usr/sbin/smbd}. QEMU was tested successfully with smbd version
+@file{!!LOCALBASE!!/libexec/smbd}. QEMU was tested successfully with smbd version
2.2.7a from the Red Hat 9 and version 3.0.10-1.fc3 from Fedora Core 3.
@item -redir [tcp|udp]:host-port:[guest-host]:guest-port
@@ -511,6 +511,16 @@ Use @var{cmdline} as kernel command line
@item -initrd file
@item -redir [tcp|udp]:@var{host-port}:[@var{guest-host}]:@var{guest-port}
@@ -682,6 +682,16 @@ Use @var{cmdline} as kernel command line
@item -initrd @var{file}
Use @var{file} as initial ram disk.
+@end table

View File

@ -1,21 +1,21 @@
$OpenBSD: patch-target-i386_helper2_c,v 1.5 2007/05/01 12:55:14 todd Exp $
--- 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));
}
}
$OpenBSD: patch-target-i386_helper2_c,v 1.6 2008/04/28 22:52:38 todd Exp $
--- target-i386/helper2.c.orig Sun Jan 6 14:38:45 2008
+++ target-i386/helper2.c Tue Apr 1 01:49:51 2008
@@ -133,7 +133,7 @@ typedef struct x86_def_t {
CPUID_PAT | CPUID_FXSR | CPUID_MMX | CPUID_SSE | CPUID_SSE2 | \
CPUID_PAE | CPUID_SEP | CPUID_APIC)
static x86_def_t x86_defs[] = {
-#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_ext2_features = (env->cpuid_features & 0x0183F3FF);
env->cpuid_ext2_features |= CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX;
@@ -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;
+/* #ifdef TARGET_X86_64 -- You must enable it for Mac OS X x86 */
{
.name = "qemu64",
.level = 2,
@@ -154,7 +154,7 @@ static x86_def_t x86_defs[] = {
.ext3_features = CPUID_EXT3_SVM,
.xlevel = 0x8000000A,
},
-#endif
+/* #endif -- To run Mac OS X x86 */
}
cpu_reset(env);
#ifdef USE_KQEMU
{
.name = "qemu32",
.level = 2,

View File

@ -1,11 +1,11 @@
$OpenBSD: patch-target-ppc_op_helper_c,v 1.4 2007/05/01 12:55:14 todd Exp $
--- 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
$OpenBSD: patch-target-ppc_op_helper_c,v 1.5 2008/04/28 22:52:38 todd Exp $
--- target-ppc/op_helper.c.orig Sun Jan 6 14:38:45 2008
+++ target-ppc/op_helper.c Tue Apr 1 01:33:40 2008
@@ -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 <math.h>
#include "exec.h"
#include "host-utils.h"
#define MEMSUFFIX _raw

View File

@ -1,8 +1,8 @@
$OpenBSD: patch-vl_c,v 1.16 2008/03/31 20:16:52 todd Exp $
--- vl.c.orig Tue Feb 6 00:01:54 2007
+++ vl.c Mon Mar 31 21:42:05 2008
@@ -44,7 +44,8 @@
#include <netdb.h>
$OpenBSD: patch-vl_c,v 1.17 2008/04/28 22:52:38 todd Exp $
--- vl.c.orig Sun Jan 6 14:38:42 2008
+++ vl.c Tue Apr 1 22:43:39 2008
@@ -61,7 +61,8 @@
#include <arpa/inet.h>
#ifdef _BSD
#include <sys/stat.h>
-#ifndef __APPLE__
@ -10,8 +10,8 @@ $OpenBSD: patch-vl_c,v 1.16 2008/03/31 20:16:52 todd Exp $
+#if !defined(__APPLE__) && !defined(__OpenBSD__)
#include <libutil.h>
#endif
#else
@@ -92,7 +93,7 @@
#elif defined (__GLIBC__) && defined (__FreeBSD_kernel__)
@@ -136,7 +137,7 @@ int inet_aton(const char *cp, struct in_addr *ia);
#ifdef __sun__
#define SMBD_COMMAND "/usr/sfw/sbin/smbd"
#else
@ -20,16 +20,8 @@ $OpenBSD: patch-vl_c,v 1.16 2008/03/31 20:16:52 todd Exp $
#endif
//#define DEBUG_UNUSED_IOPORT
@@ -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;
@@ -3491,7 +3492,7 @@ static int parse_macaddr(uint8_t *macaddr, const char
return -1;
}
-static int get_str_sep(char *buf, int buf_size, const char **pp, int sep)
@ -37,13 +29,13 @@ $OpenBSD: patch-vl_c,v 1.16 2008/03/31 20:16:52 todd Exp $
{
const char *p, *p1;
int len;
@@ -3226,11 +3228,85 @@ static int tap_open(char *ifname, int ifname_size)
@@ -3922,11 +3923,85 @@ static int tap_open(char *ifname, int ifname_size)
char *dev;
struct stat s;
+ /* If the device was specified on the command line, use it */
+ if (ifname[0]) {
+ fd = open(ifname, O_RDWR);
+ TFR(fd = open(ifname, O_RDWR));
+ if (fd < 0) {
+ fprintf(stderr, "warning: could not open %s: no virtual network emulation\n", ifname);
+ return -1;
@ -52,7 +44,7 @@ $OpenBSD: patch-vl_c,v 1.16 2008/03/31 20:16:52 todd Exp $
+#ifdef __OpenBSD__
+ struct ifreq ifr;
+ int i = 0, enoentcount = 0, err = 0, sock;
+ char dname[100], iname[100];
+ char dname[100];
+
+ bzero(&ifr, sizeof(ifr));
+ if (ifname != NULL && ifname[0] != '\0') {
@ -62,17 +54,17 @@ $OpenBSD: patch-vl_c,v 1.16 2008/03/31 20:16:52 todd Exp $
+ } else {
+ for (; i != -1; i++) {
+ snprintf(dname, sizeof dname, "/dev/tun%d", i);
+ bzero(&ifr.ifr_name, sizeof(ifr.ifr_name));
+ bzero(&ifr.ifr_name, sizeof(ifr.ifr_name));
+ snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "tun%d", i);
+ fd = open(dname, O_RDWR);
+ TFR(fd = open(dname, O_RDWR));
+ if (fd >= 0)
+ break;
+ else if (errno != ENOENT || ++enoentcount > 3) {
+ if (errno != EBUSY) {
+ err = errno;
+ break;
+ }
+ } else
+ }
+ } else
+ err = errno;
+ }
+ }
@ -113,7 +105,7 @@ $OpenBSD: patch-vl_c,v 1.16 2008/03/31 20:16:52 todd Exp $
+ }
+
+#else
fd = open("/dev/tap", O_RDWR);
TFR(fd = open("/dev/tap", O_RDWR));
if (fd < 0) {
fprintf(stderr, "warning: could not open /dev/tap: no virtual network emulation\n");
return -1;
@ -123,25 +115,25 @@ $OpenBSD: patch-vl_c,v 1.16 2008/03/31 20:16:52 todd Exp $
fstat(fd, &s);
dev = devname(s.st_rdev, S_IFCHR);
@@ -3282,6 +3358,7 @@ static int net_tap_init(VLANState *vlan, const char *i
char *args[3];
char **parg;
@@ -4141,6 +4216,7 @@ static int net_tap_init(VLANState *vlan, const char *i
TAPState *s;
int fd;
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
@@ -4320,7 +4396,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,
ret=setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
- (const char *)&val, sizeof(val));
+ (const char *)&val, sizeof(char));
if (ret < 0) {
perror("setsockopt(SOL_IP, IP_MULTICAST_LOOP)");
goto fail;
@@ -3732,7 +3809,8 @@ static int net_socket_mcast_init(VLANState *vlan, cons
@@ -4609,7 +4685,8 @@ static const char *get_word(char *buf, int buf_size, c
return p;
}
-static int get_param_value(char *buf, int buf_size,
@ -150,16 +142,17 @@ $OpenBSD: patch-vl_c,v 1.16 2008/03/31 20:16:52 todd Exp $
const char *tag, const char *str)
{
const char *p;
@@ -3856,6 +3934,8 @@ static int net_client_init(const char *str)
if (!strcmp(device, "tap")) {
@@ -4748,6 +4825,9 @@ static int net_client_init(const char *str)
char ifname[64];
char setup_script[1024];
+ bzero(&ifname,sizeof(ifname));
+ bzero(&setup_script,sizeof(setup_script));
char setup_script[1024], down_script[1024];
int fd;
+ bzero(&ifname, sizeof(ifname));
+ bzero(&setup_script, sizeof(setup_script));
+ bzero(&down_script, sizeof(down_script));
vlan->nb_host_devs++;
if (get_param_value(buf, sizeof(buf), "fd", p) > 0) {
fd = strtol(buf, NULL, 0);
@@ -3863,13 +3943,13 @@ static int net_client_init(const char *str)
@@ -4755,16 +4835,16 @@ static int net_client_init(const char *str)
if (net_tap_fd_init(vlan, fd))
ret = 0;
} else {
@ -169,49 +162,18 @@ $OpenBSD: patch-vl_c,v 1.16 2008/03/31 20:16:52 todd Exp $
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(down_script, sizeof(down_script), "downscript", p) == 0) {
pstrcpy(down_script, sizeof(down_script), DEFAULT_NETWORK_DOWN_SCRIPT);
}
- ret = net_tap_init(vlan, ifname, setup_script, down_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, NULL, setup_script);
+ ret = net_tap_init(vlan, NULL, setup_script, down_script);
+ else
+ ret = net_tap_init(vlan, NULL, setup_script, down_script);
}
} else
#endif
@@ -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 },
@@ -6329,6 +6412,7 @@ static void read_passwords(void)
for(i = 0; i < 6; i++) {
bs = get_bdrv(i);
if (bs && bdrv_is_encrypted(bs)) {
+ qemu_bh_poll();
term_printf("%s is encrypted.\n", bdrv_get_device_name(bs));
for(j = 0; j < 3; j++) {
monitor_readline("Password: ",
@@ -6570,7 +6654,11 @@ int main(int argc, char **argv)
@@ -8130,19 +8210,23 @@ int main(int argc, char **argv)
gdbstub_port = DEFAULT_GDBSTUB_PORT;
#endif
snapshot = 0;
@ -222,32 +184,19 @@ $OpenBSD: patch-vl_c,v 1.16 2008/03/31 20:16:52 todd Exp $
+#endif
kernel_filename = NULL;
kernel_cmdline = "";
#ifdef TARGET_PPC
@@ -6580,14 +6668,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(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;
- pstrcpy(parallel_devices[0], sizeof(parallel_devices[0]), "vc");
+ pstrcpy(parallel_devices[0], sizeof(parallel_devices[0]), "null");
for(i = 1; i < MAX_PARALLEL_PORTS; i++)
parallel_devices[i][0] = '\0';
parallel_device_index = 0;
@@ -6940,6 +7028,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;

View File

@ -1,22 +0,0 @@
$OpenBSD: patch-vl_h,v 1.7 2007/05/01 12:55:14 todd Exp $
--- 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
/* 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);

View File

@ -1,14 +1,2 @@
+---------------
| Quick Start:
| 1. get a bootable floppy image
| 2. qemu-img create -f qcow2 virtual.hd 10G
| 3. qemu -m 32 -fda floppy.fs -boot a -monitor stdio virtual.hd
| (initial install to hard drive)
| 4. qemu-img convert -c -O qcow2 virtual.hd tmp && mv tmp virtual.hd
| (compress hard drive while qemu is not running)
| 5. qemu -m 32 -monitor stdio virtual.hd
| (normal boot from hard drive)
|
| Note: Customize ${SYSCONFDIR}/qemu-ifup to use '-net tap' on your system.
+---------------
Please see ${LOCALBASE}/share/doc/qemu/README.OpenBSD for
a brief intro to using qemu on OpenBSD.

View File

@ -1,23 +1,37 @@
@comment $OpenBSD: PLIST,v 1.9 2008/03/31 20:59:21 okan Exp $
@comment $OpenBSD: PLIST,v 1.10 2008/04/28 22:52:38 todd Exp $
@pkgpath emulators/qemu,kqemu
bin/qemu
bin/qemu-img
bin/qemu-system-arm
bin/qemu-system-cris
bin/qemu-system-m68k
bin/qemu-system-mips
bin/qemu-system-mips64
bin/qemu-system-mips64el
bin/qemu-system-mipsel
bin/qemu-system-ppc
bin/qemu-system-ppc64
bin/qemu-system-ppcemb
bin/qemu-system-sh4
bin/qemu-system-sh4eb
bin/qemu-system-sparc
bin/qemu-system-x86_64
@man man/man1/qemu-img.1
@man man/man1/qemu.1
share/doc/qemu/
share/doc/qemu/README.OpenBSD
share/doc/qemu/qemu-doc.html
share/doc/qemu/qemu-tech.html
share/examples/qemu/
share/examples/qemu/qemu-ifdown
@mode 755
@sample ${SYSCONFDIR}/qemu-ifdown
@mode
share/examples/qemu/qemu-ifup
@mode 755
@sample ${SYSCONFDIR}/qemu-ifup
@mode
share/nls/pl_PL.ISO_8859-2/
share/qemu/
share/qemu/bios.bin
share/qemu/keymaps/
@ -56,7 +70,6 @@ share/qemu/keymaps/sl
share/qemu/keymaps/sv
share/qemu/keymaps/th
share/qemu/keymaps/tr
share/qemu/linux_boot.bin
share/qemu/openbios-sparc32
share/qemu/ppc_rom.bin
share/qemu/pxe-ne2k_pci.bin