From: Rumko <rumcic@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Patches from pkgsrc for 0.9.1
Date: Wed, 16 Jan 2008 09:52:35 +0100 [thread overview]
Message-ID: <478dc598$0$848$415eb37d@crater_reader.dragonflybsd.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 2405 bytes --]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
After more than 10 hours the article still didn't show up, so I'm resending
just in case
Some patches are present in pkgsrc that should be sent upstream, so I have
attached the patches and some information about the patches below.
patch-aa: some machines have <machine/bswap.h> instead of <byteswap.h>
patch-ab: qemu (op.c) shouldn't be compiled with the stack-protector turned on,
so this patch adds the needed -fno-stack-protector if it is used by default
patch-ac: on NetBSD some operations are not supported
patch-ad: on DragonFly <sys/disk.h> must not be included by userland programs
patch-ae: I was unable to compile slavio_serial.c using gcc 3.4.6 because of
some inlining errors, but just reordering the functions makes it compile
cleanly
patch-ag: DragonFly support is added, a check for <machine/bswap.h> and the
stack protector are added as well
patch-am: I'm not quite sure what this is for ... but this patch has existed
for a bit more than 3 years ... maybe ioctl needs 3 args on some systems?
patch-ao: as the comment added by the patch says, this is a work around some
ugly #defines in NetBSD 2.x
patch-au: defines some possibly missing functionality on NetBSD
patch-av: quoted ... "Provide trunc() implementation for NetBSD 3 and
Dragonfly"
patch-aw: quoted ... "Workaround for x86_64 target, patch from Hubert Feyrer."
patch-ax: quoted from cvs revision history ... "Apply patches from Tobyas
Nigren (PR pkg/32464) to make this build on NetBSD/amd64. Thank you Tobias!"
patch-ay: quoted from cvs revision history ... "Update to 0.9.0. Thanks to
Michael Van Elst for sending me the missing patch to let this build on systems
without POSIX AIO."
patch-ba: quoted from cvs revision history ... "Add patches/patch-ba:
Emulate the speaker port's refresh clock bit. This is supposed
to toggle between 0 and 1<<4 every 15 microseconds. XXX: We use
gettimeofday() in the real machine instead of a monotonic clock
in the virtual machine, and we are a bit sloppy about the 15
microseconds. This should be good enough for crude loops that
measure approximate delays by counting how often this line toggles."
- --
Regards,
Rumko
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (DragonFly)
iD8DBQFHjcWTxV3ce2RZW70RArGaAKDKwmH1Aq4c0Xy9fLsIOi875bQaJACgmV+1
VMYqcjSZhd/uqTMmCulc+vA=
=0ftn
-----END PGP SIGNATURE-----
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-aa --]
[-- Type: text/x-diff; name="patch-aa", Size: 499 bytes --]
$NetBSD: patch-aa,v 1.3 2004/12/14 01:02:19 dbj Exp $
--- bswap.h.orig Sun Nov 14 15:51:33 2004
+++ bswap.h
@@ -5,6 +5,12 @@
#include <inttypes.h>
+#ifdef HAVE_MACHINE_BSWAP_H
+#include <sys/endian.h>
+#include <sys/types.h>
+#include <machine/bswap.h>
+#else
+
#ifdef HAVE_BYTESWAP_H
#include <byteswap.h>
#else
@@ -57,6 +63,8 @@ static inline uint64_t bswap64(uint64_t
{
return bswap_64(x);
}
+
+#endif /* ! HAVE_MACHINE_BSWAP_H */
static inline void bswap16s(uint16_t *s)
{
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: patch-ab --]
[-- Type: text/x-diff; name="patch-ab", Size: 438 bytes --]
$NetBSD: patch-ab,v 1.8 2007/12/30 17:12:44 joerg Exp $
--- Makefile.target.orig 2007-02-05 23:01:54 +0000
+++ Makefile.target
@@ -99,6 +99,10 @@ endif
# We require -O2 to avoid the stack setup prologue in EXIT_TB
OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing
+ifdef STACK_PROTECTOR_PRESENT
+OP_CFLAGS += -fno-stack-protector
+endif
+
# cc-option
# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: patch-ac --]
[-- Type: text/x-diff; name="patch-ac", Size: 583 bytes --]
$NetBSD: patch-ac,v 1.9 2007/12/18 00:16:56 joerg Exp $
--- vl.c.orig 2007-05-02 01:56:26.000000000 +0200
+++ vl.c 2007-05-02 01:57:42.000000000 +0200
@@ -2385,6 +2385,9 @@
static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)
{
+#ifdef __NetBSD__
+ return ENOTSUP;
+#endif
ParallelCharDriver *drv = chr->opaque;
int fd = drv->fd;
uint8_t b;
@@ -2473,6 +2476,9 @@
static CharDriverState *qemu_chr_open_pp(const char *filename)
{
+#ifdef __NetBSD__
+ return ENOTSUP;
+#endif
CharDriverState *chr;
ParallelCharDriver *drv;
int fd;
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: patch-ad --]
[-- Type: text/x-diff; name="patch-ad", Size: 330 bytes --]
$NetBSD: patch-ad,v 1.3 2007/12/30 17:12:45 joerg Exp $
--- block.c.orig 2007-02-05 23:01:54 +0000
+++ block.c
@@ -29,8 +29,10 @@
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/queue.h>
+#ifndef __DragonFly__
#include <sys/disk.h>
#endif
+#endif
#define SECTOR_BITS 9
#define SECTOR_SIZE (1 << SECTOR_BITS)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: patch-ae --]
[-- Type: text/x-diff; name="patch-ae", Size: 3353 bytes --]
$NetBSD$
--- hw/slavio_serial.c.orig 2008-01-15 17:25:29 +0100
+++ hw/slavio_serial.c 2008-01-15 17:25:30 +0100
@@ -215,7 +215,6 @@
static void handle_kbd_command(ChannelState *s, int val);
static int serial_can_receive(void *opaque);
static void serial_receive_byte(ChannelState *s, int ch);
-static inline void set_txint(ChannelState *s);
static void clear_queue(void *opaque)
{
@@ -321,28 +320,6 @@
slavio_serial_reset_chn(&s->chn[1]);
}
-static inline void clr_rxint(ChannelState *s)
-{
- s->rxint = 0;
- s->rxint_under_svc = 0;
- if (s->chn == chn_a) {
- if (s->wregs[W_MINTR] & MINTR_STATUSHI)
- s->otherchn->rregs[R_IVEC] = IVEC_HINOINT;
- else
- s->otherchn->rregs[R_IVEC] = IVEC_LONOINT;
- s->rregs[R_INTR] &= ~INTR_RXINTA;
- } else {
- if (s->wregs[W_MINTR] & MINTR_STATUSHI)
- s->rregs[R_IVEC] = IVEC_HINOINT;
- else
- s->rregs[R_IVEC] = IVEC_LONOINT;
- s->otherchn->rregs[R_INTR] &= ~INTR_RXINTB;
- }
- if (s->txint)
- set_txint(s);
- slavio_serial_update_irq(s);
-}
-
static inline void set_rxint(ChannelState *s)
{
s->rxint = 1;
@@ -367,6 +344,49 @@
slavio_serial_update_irq(s);
}
+static inline void set_txint(ChannelState *s)
+{
+ s->txint = 1;
+ if (!s->rxint_under_svc) {
+ s->txint_under_svc = 1;
+ if (s->chn == chn_a) {
+ if (s->wregs[W_MINTR] & MINTR_STATUSHI)
+ s->otherchn->rregs[R_IVEC] = IVEC_HITXINTA;
+ else
+ s->otherchn->rregs[R_IVEC] = IVEC_LOTXINTA;
+ } else {
+ s->rregs[R_IVEC] = IVEC_TXINTB;
+ }
+ }
+ if (s->chn == chn_a)
+ s->rregs[R_INTR] |= INTR_TXINTA;
+ else
+ s->otherchn->rregs[R_INTR] |= INTR_TXINTB;
+ slavio_serial_update_irq(s);
+}
+
+static inline void clr_rxint(ChannelState *s)
+{
+ s->rxint = 0;
+ s->rxint_under_svc = 0;
+ if (s->chn == chn_a) {
+ if (s->wregs[W_MINTR] & MINTR_STATUSHI)
+ s->otherchn->rregs[R_IVEC] = IVEC_HINOINT;
+ else
+ s->otherchn->rregs[R_IVEC] = IVEC_LONOINT;
+ s->rregs[R_INTR] &= ~INTR_RXINTA;
+ } else {
+ if (s->wregs[W_MINTR] & MINTR_STATUSHI)
+ s->rregs[R_IVEC] = IVEC_HINOINT;
+ else
+ s->rregs[R_IVEC] = IVEC_LONOINT;
+ s->otherchn->rregs[R_INTR] &= ~INTR_RXINTB;
+ }
+ if (s->txint)
+ set_txint(s);
+ slavio_serial_update_irq(s);
+}
+
static inline void clr_txint(ChannelState *s)
{
s->txint = 0;
@@ -389,27 +409,6 @@
slavio_serial_update_irq(s);
}
-static inline void set_txint(ChannelState *s)
-{
- s->txint = 1;
- if (!s->rxint_under_svc) {
- s->txint_under_svc = 1;
- if (s->chn == chn_a) {
- if (s->wregs[W_MINTR] & MINTR_STATUSHI)
- s->otherchn->rregs[R_IVEC] = IVEC_HITXINTA;
- else
- s->otherchn->rregs[R_IVEC] = IVEC_LOTXINTA;
- } else {
- s->rregs[R_IVEC] = IVEC_TXINTB;
- }
- }
- if (s->chn == chn_a)
- s->rregs[R_INTR] |= INTR_TXINTA;
- else
- s->otherchn->rregs[R_INTR] |= INTR_TXINTB;
- slavio_serial_update_irq(s);
-}
-
static void slavio_serial_update_parameters(ChannelState *s)
{
int speed, parity, data_bits, stop_bits;
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: patch-ag --]
[-- Type: text/x-diff; name="patch-ag", Size: 1479 bytes --]
$NetBSD: patch-ag,v 1.10 2008/01/04 21:37:07 sborrill Exp $
--- configure.orig 2007-02-05 23:01:54 +0000
+++ configure
@@ -44,7 +44,7 @@ case "$cpu" in
alpha)
cpu="alpha"
;;
- "Power Macintosh"|ppc|ppc64)
+ "Power Macintosh"|ppc|ppc64|powerpc)
cpu="powerpc"
;;
mips)
@@ -136,6 +136,12 @@ if [ "$cpu" = "i386" -o "$cpu" = "x86_64
kqemu="yes"
fi
;;
+DragonFly)
+bsd="yes"
+oss="yes"
+dragonfly="yes"
+;;
+
NetBSD)
bsd="yes"
oss="yes"
@@ -478,6 +484,16 @@ EOF
fi
fi
+# Check for stack protector
+cat > $TMPC <<EOF
+extern int foo;
+EOF
+if ! "$cc" -o $TMPE $TMPC -fno-stack-protector 2> /dev/null ; then
+ stack_protector_present="yes"
+else
+ stack_protector_present="no"
+fi
+
#
# Solaris specific configure tool chain decisions
#
@@ -848,6 +864,14 @@ if test "$mingw32" = "yes" ; then
EOF
if $cc -o $TMPE $TMPC 2> /dev/null ; then
echo "#define HAVE_BYTESWAP_H 1" >> $config_h
+ else
+ cat > $TMPC << EOF
+#include <machine/bswap.h>
+int main(void) { return bswap_32(0); }
+EOF
+ if $cc -o $TMPE $TMPC 2> /dev/null ; then
+ echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
+ fi
fi
fi
if test "$darwin" = "yes" ; then
@@ -960,6 +984,10 @@ if [ "$bsd" = "yes" ] ; then
echo "#define _BSD 1" >> $config_h
fi
+if [ "$stack_protector_present" = "yes" ] ; then
+ echo "STACK_PROTECTOR_PRESENT=yes" >> $config_mak
+fi
+
echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
tools=
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #8: patch-am --]
[-- Type: text/x-diff; name="patch-am", Size: 424 bytes --]
$NetBSD: patch-am,v 1.2 2006/01/01 13:48:45 xtraeme Exp $
--- audio/ossaudio.c.orig 2005-12-19 17:51:53.000000000 -0500
+++ audio/ossaudio.c
@@ -229,7 +229,7 @@ static int oss_open (int in, struct oss_
goto err;
}
- if (ioctl (fd, SNDCTL_DSP_NONBLOCK)) {
+ if (ioctl (fd, SNDCTL_DSP_NONBLOCK, NULL)) {
oss_logerr2 (errno, typ, "Failed to set non-blocking mode\n");
goto err;
}
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #9: patch-ao --]
[-- Type: text/x-diff; name="patch-ao", Size: 6410 bytes --]
$NetBSD: patch-ao,v 1.2 2006/01/01 13:48:45 xtraeme Exp $
--- audio/mixeng.c.orig 2005-12-19 17:51:53.000000000 -0500
+++ audio/mixeng.c
@@ -145,56 +145,64 @@
#undef IN_T
#undef SHIFT
+/*
+ * Work around ugly XX_t #defines in NetBSD 2.x,
+ * fixed as typedefs in NetBSD 3.x. Two macros needed to
+ * get CPP defines expanded properly. - HF
+ */
+#define _NBglue(x,y,z) x ## y ## z
+#define NBglue(x,y,z) _NBglue(x,y,z)
+
t_sample *mixeng_conv[2][2][2][3] = {
{
{
{
- conv_natural_uint8_t_to_mono,
- conv_natural_uint16_t_to_mono,
- conv_natural_uint32_t_to_mono
+ NBglue(conv_natural_, uint8_t, _to_mono),
+ NBglue(conv_natural_, uint16_t, _to_mono),
+ NBglue(conv_natural_, uint32_t, _to_mono)
},
{
- conv_natural_uint8_t_to_mono,
- conv_swap_uint16_t_to_mono,
- conv_swap_uint32_t_to_mono,
+ NBglue(conv_natural_, uint8_t, _to_mono),
+ NBglue(conv_swap_, uint16_t, _to_mono),
+ NBglue(conv_swap_, uint32_t, _to_mono)
}
},
{
{
- conv_natural_int8_t_to_mono,
- conv_natural_int16_t_to_mono,
- conv_natural_int32_t_to_mono
+ NBglue(conv_natural_, int8_t, _to_mono),
+ NBglue(conv_natural_, int16_t, _to_mono),
+ NBglue(conv_natural_, int32_t, _to_mono)
},
{
- conv_natural_int8_t_to_mono,
- conv_swap_int16_t_to_mono,
- conv_swap_int32_t_to_mono
+ NBglue(conv_natural_, int8_t, _to_mono),
+ NBglue(conv_swap_, int16_t, _to_mono),
+ NBglue(conv_swap_, int32_t, _to_mono)
}
}
},
{
{
{
- conv_natural_uint8_t_to_stereo,
- conv_natural_uint16_t_to_stereo,
- conv_natural_uint32_t_to_stereo
+ NBglue(conv_natural_, uint8_t, _to_stereo),
+ NBglue(conv_natural_, uint16_t, _to_stereo),
+ NBglue(conv_natural_, uint32_t, _to_stereo)
},
{
- conv_natural_uint8_t_to_stereo,
- conv_swap_uint16_t_to_stereo,
- conv_swap_uint32_t_to_stereo
+ NBglue(conv_natural_, uint8_t, _to_stereo),
+ NBglue(conv_swap_, uint16_t, _to_stereo),
+ NBglue(conv_swap_, uint32_t, _to_stereo)
}
},
{
{
- conv_natural_int8_t_to_stereo,
- conv_natural_int16_t_to_stereo,
- conv_natural_int32_t_to_stereo
+ NBglue(conv_natural_, int8_t, _to_stereo),
+ NBglue(conv_natural_, int16_t, _to_stereo),
+ NBglue(conv_natural_, int32_t, _to_stereo)
},
{
- conv_natural_int8_t_to_stereo,
- conv_swap_int16_t_to_stereo,
- conv_swap_int32_t_to_stereo,
+ NBglue(conv_natural_, int8_t, _to_stereo),
+ NBglue(conv_swap_, int16_t, _to_stereo),
+ NBglue(conv_swap_, int32_t, _to_stereo)
}
}
}
@@ -212,52 +220,52 @@ f_sample *mixeng_clip[2][2][2][3] = {
{
{
{
- clip_natural_uint8_t_from_mono,
- clip_natural_uint16_t_from_mono,
- clip_natural_uint32_t_from_mono
+ NBglue(clip_natural_, uint8_t, _from_mono),
+ NBglue(clip_natural_, uint16_t, _from_mono),
+ NBglue(clip_natural_, uint32_t, _from_mono)
},
{
- clip_natural_uint8_t_from_mono,
- clip_swap_uint16_t_from_mono,
- clip_swap_uint32_t_from_mono
+ NBglue(clip_natural_, uint8_t, _from_mono),
+ NBglue(clip_swap_, uint16_t, _from_mono),
+ NBglue(clip_swap_, uint32_t, _from_mono)
}
},
{
{
- clip_natural_int8_t_from_mono,
- clip_natural_int16_t_from_mono,
- clip_natural_int32_t_from_mono
+ NBglue(clip_natural_, int8_t, _from_mono),
+ NBglue(clip_natural_, int16_t, _from_mono),
+ NBglue(clip_natural_, int32_t, _from_mono)
},
{
- clip_natural_int8_t_from_mono,
- clip_swap_int16_t_from_mono,
- clip_swap_int32_t_from_mono
+ NBglue(clip_natural_, int8_t, _from_mono),
+ NBglue(clip_swap_, int16_t, _from_mono),
+ NBglue(clip_swap_, int32_t, _from_mono)
}
}
},
{
{
{
- clip_natural_uint8_t_from_stereo,
- clip_natural_uint16_t_from_stereo,
- clip_natural_uint32_t_from_stereo
+ NBglue(clip_natural_, uint8_t, _from_stereo),
+ NBglue(clip_natural_, uint16_t, _from_stereo),
+ NBglue(clip_natural_, uint32_t, _from_stereo)
},
{
- clip_natural_uint8_t_from_stereo,
- clip_swap_uint16_t_from_stereo,
- clip_swap_uint32_t_from_stereo
+ NBglue(clip_natural_, uint8_t, _from_stereo),
+ NBglue(clip_swap_, uint16_t, _from_stereo),
+ NBglue(clip_swap_, uint32_t, _from_stereo)
}
},
{
{
- clip_natural_int8_t_from_stereo,
- clip_natural_int16_t_from_stereo,
- clip_natural_int32_t_from_stereo
+ NBglue(clip_natural_, int8_t, _from_stereo),
+ NBglue(clip_natural_, int16_t, _from_stereo),
+ NBglue(clip_natural_, int32_t, _from_stereo)
},
{
- clip_natural_int8_t_from_stereo,
- clip_swap_int16_t_from_stereo,
- clip_swap_int32_t_from_stereo
+ NBglue(clip_natural_, int8_t, _from_stereo),
+ NBglue(clip_swap_, int16_t, _from_stereo),
+ NBglue(clip_swap_, int32_t, _from_stereo)
}
}
}
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #10: patch-au --]
[-- Type: text/x-diff; name="patch-au", Size: 774 bytes --]
$NetBSD: patch-au,v 1.4 2007/12/18 00:16:56 joerg Exp $
--- fpu/softfloat-native.h.orig 2007-02-06 00:01:54.000000000 +0100
+++ fpu/softfloat-native.h 2007-05-02 01:54:50.000000000 +0200
@@ -33,6 +33,24 @@
#define isunordered(x,y) unordered(x, y)
#endif
+#ifdef __NetBSD__
+#ifndef isgreater
+#define isgreater(x, y) __builtin_isgreater(x, y)
+#endif
+#ifndef isgreaterequal
+#define isgreaterequal(x, y) __builtin_isgreaterequal(x, y)
+#endif
+#ifndef isless
+#define isless(x, y) __builtin_isless(x, y)
+#endif
+#ifndef islessequal
+#define islessequal(x, y) __builtin_islessequal(x, y)
+#endif
+#ifndef isunordered
+#define isunordered(x, y) __builtin_isunordered(x, y)
+#endif
+#endif
+
#if defined(__sun__) && !defined(NEED_LIBSUNMATH)
#ifndef isnan
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #11: patch-av --]
[-- Type: text/x-diff; name="patch-av", Size: 713 bytes --]
$NetBSD: patch-av,v 1.3 2007/10/07 21:21:00 heinz Exp $
Provide trunc() implementation for NetBSD 3 and Dragonfly
--- fpu/softfloat-native.c.orig 2007-02-06 00:01:54.000000000 +0100
+++ fpu/softfloat-native.c
@@ -3,6 +3,20 @@
#include "softfloat.h"
#include <math.h>
+#if defined(__DragonFly__) || defined(__NetBSD__)
+# include <sys/param.h>
+#endif
+
+#if (defined(__DragonFly__) && __DragonFly_version < 195000) || (defined(__NetBSD__) && __NetBSD_Version__ <= 399001700)
+static double trunc( double val )
+{
+ if (val > 0)
+ return floor(val);
+ else
+ return ceil(val);
+}
+#endif
+
void set_float_rounding_mode(int val STATUS_PARAM)
{
STATUS(float_rounding_mode) = val;
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #12: patch-aw --]
[-- Type: text/x-diff; name="patch-aw", Size: 780 bytes --]
$NetBSD: patch-aw,v 1.2 2007/01/06 21:21:35 xtraeme Exp $
Workaround for x86_64 target, patch from Hubert Feyrer.
Index: dyngen.c
===================================================================
RCS file: /cvsroot/qemu/qemu/dyngen.c,v
retrieving revision 1.40
diff -u -r1.40 dyngen.c
--- dyngen.c.orig 2007-01-05 20:32:17.000000000 +0000
+++ dyngen.c 2007-01-05 20:36:45.000000000 +0000
@@ -1738,6 +1738,7 @@
if(!sym_name)
continue;
if (*sym_name &&
+ !strstart(sym_name, "bswap64", NULL) && /* HF hack */
!strstart(sym_name, "__op_param", NULL) &&
!strstart(sym_name, "__op_jmp", NULL) &&
!strstart(sym_name, "__op_gen_label", NULL)) {
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #13: patch-ax --]
[-- Type: text/x-diff; name="patch-ax", Size: 531 bytes --]
$NetBSD: patch-ax,v 1.3 2006/01/06 09:17:03 xtraeme Exp $
--- target-i386/op.c.orig 2006-01-06 05:10:30.000000000 +0100
+++ target-i386/op.c
@@ -2099,14 +2099,17 @@ void OPPROTO op_fdivr_STN_ST0(void)
}
/* misc FPU operations */
+
+void fchs_dummy() {ST0 = floatx_chs(ST0);}
void OPPROTO op_fchs_ST0(void)
{
- ST0 = floatx_chs(ST0);
+ fchs_dummy();
}
+void fabs_dummy() {ST0 = floatx_abs(ST0);}
void OPPROTO op_fabs_ST0(void)
{
- ST0 = floatx_abs(ST0);
+ fabs_dummy();
}
void OPPROTO op_fxam_ST0(void)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #14: patch-ay --]
[-- Type: text/x-diff; name="patch-ay", Size: 1873 bytes --]
$NetBSD: patch-ay,v 1.7 2007/05/21 20:24:48 xtraeme Exp $
--- block-raw-posix.c.orig 2007-02-06 00:01:54.000000000 +0100
+++ block-raw-posix.c
@@ -28,7 +28,9 @@
#endif
#include "block_int.h"
#include <assert.h>
+#ifdef _POSIX_ASYNCHRONOUS_IO
#include <aio.h>
+#endif
#ifdef CONFIG_COCOA
#include <paths.h>
@@ -230,6 +232,7 @@ static int raw_pwrite(BlockDriverState *
return ret;
}
+#ifdef _POSIX_ASYNCHRONOUS_IO
/***********************************************************/
/* Unix AIO using POSIX AIO */
@@ -455,6 +458,7 @@ static void raw_aio_cancel(BlockDriverAI
pacb = &acb->next;
}
}
+#endif
static void raw_close(BlockDriverState *bs)
{
@@ -545,6 +549,35 @@ static void raw_flush(BlockDriverState *
fsync(s->fd);
}
+#ifndef _POSIX_ASYNCHRONOUS_IO
+void qemu_aio_init(void)
+{
+}
+
+void qemu_aio_poll(void)
+{
+}
+
+void qemu_aio_flush(void)
+{
+}
+
+void qemu_aio_wait_start(void)
+{
+}
+
+void qemu_aio_wait(void)
+{
+#ifndef QEMU_IMG
+ qemu_bh_poll();
+#endif
+}
+
+void qemu_aio_wait_end(void)
+{
+}
+#endif
+
BlockDriver bdrv_raw = {
"raw",
sizeof(BDRVRawState),
@@ -556,10 +589,12 @@ BlockDriver bdrv_raw = {
raw_create,
raw_flush,
+#ifdef _POSIX_ASYNCHRONOUS_IO
.bdrv_aio_read = raw_aio_read,
.bdrv_aio_write = raw_aio_write,
.bdrv_aio_cancel = raw_aio_cancel,
.aiocb_size = sizeof(RawAIOCB),
+#endif
.protocol_name = "file",
.bdrv_pread = raw_pread,
.bdrv_pwrite = raw_pwrite,
@@ -908,10 +943,12 @@ BlockDriver bdrv_host_device = {
NULL,
raw_flush,
+#ifdef _POSIX_ASYNCHRONOUS_IO
.bdrv_aio_read = raw_aio_read,
.bdrv_aio_write = raw_aio_write,
.bdrv_aio_cancel = raw_aio_cancel,
.aiocb_size = sizeof(RawAIOCB),
+#endif
.bdrv_pread = raw_pread,
.bdrv_pwrite = raw_pwrite,
.bdrv_getlength = raw_getlength,
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #15: patch-ba --]
[-- Type: text/x-diff; name="patch-ba", Size: 1502 bytes --]
$NetBSD: patch-ba,v 1.1 2007/12/24 10:18:22 apb Exp $
--- hw/pcspk.c.orig 2007-02-06 01:01:54.000000000 +0200
+++ hw/pcspk.c
@@ -38,7 +38,6 @@ typedef struct {
unsigned int samples;
unsigned int play_pos;
int data_on;
- int dummy_refresh_clock;
} PCSpkState;
static const char *s_spk = "pcspk";
@@ -112,15 +111,32 @@ int pcspk_audio_init(AudioState *audio)
return 0;
}
+/*
+ * Emulate the speaker port's refresh clock bit. This is supposed
+ * to toggle between 0 and 1<<4 every 15 microseconds. XXX: We use
+ * gettimeofday() in the real machine instead of a monotonic clock
+ * in the virtual machine, and we are a bit sloppy about the 15
+ * microseconds. This should be good enough for crude loops that
+ * measure approximate delays by counting how often this line toggles.
+ */
+static uint32_t pcspk_dummy_refresh_clock(void)
+{
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+ return ((tv.tv_sec ^ (tv.tv_usec / 15)) & 1) << 4;
+}
+
static uint32_t pcspk_ioport_read(void *opaque, uint32_t addr)
{
PCSpkState *s = opaque;
int out;
+ int dummy_refresh_clock;
- s->dummy_refresh_clock ^= (1 << 4);
out = pit_get_out(s->pit, 2, qemu_get_clock(vm_clock)) << 5;
- return pit_get_gate(s->pit, 2) | (s->data_on << 1) | s->dummy_refresh_clock | out;
+ return pit_get_gate(s->pit, 2) | (s->data_on << 1) |
+ pcspk_dummy_refresh_clock() | out;
}
static void pcspk_ioport_write(void *opaque, uint32_t addr, uint32_t val)
next reply other threads:[~2008-01-16 8:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-16 8:52 Rumko [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-01-15 18:15 [Qemu-devel] Patches from pkgsrc for 0.9.1 Rumko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='478dc598$0$848$415eb37d@crater_reader.dragonflybsd.org' \
--to=rumcic@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.