Patches from pkgsrc for 0.9.1
-----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-----
$NetBSD: patch-aa,v 1.3 2004/12/14 01:02:19 dbj Exp $
bswap.h renamed from bswap.h.orig +8 -0
@@ -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) {
$NetBSD: patch-ab,v 1.8 2007/12/30 17:12:44 joerg Exp $
Makefile.target renamed from Makefile.target.orig +4 -0
@@ -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)
$NetBSD: patch-ac,v 1.9 2007/12/18 00:16:56 joerg Exp $
vl.c renamed from vl.c.orig +6 -0
@@ -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;
$NetBSD: patch-ad,v 1.3 2007/12/30 17:12:45 joerg Exp $
block.c renamed from block.c.orig +2 -0
@@ -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)
$NetBSD$
slavio_serial.c renamed from slavio_serial.c.orig +43 -44
111 lines not on this page · raw message
$NetBSD: patch-ag,v 1.10 2008/01/04 21:37:07 sborrill Exp $
configure renamed from configure.orig +29 -1
@@ -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=
$NetBSD: patch-am,v 1.2 2006/01/01 13:48:45 xtraeme Exp $
ossaudio.c renamed from ossaudio.c.orig +1 -1
@@ -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; }
$NetBSD: patch-ao,v 1.2 2006/01/01 13:48:45 xtraeme Exp $
mixeng.c renamed from mixeng.c.orig +56 -48
164 lines not on this page · raw message
$NetBSD: patch-au,v 1.4 2007/12/18 00:16:56 joerg Exp $
softfloat-native.h renamed from softfloat-native.h.orig +18 -0
@@ -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
$NetBSD: patch-av,v 1.3 2007/10/07 21:21:00 heinz Exp $
Provide trunc() implementation for NetBSD 3 and Dragonfly
softfloat-native.c renamed from softfloat-native.c.orig +14 -0
@@ -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;
$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
dyngen.c renamed from dyngen.c.orig +1 -0
@@ -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 )) {
$NetBSD: patch-ax,v 1.3 2006/01/06 09:17:03 xtraeme Exp $
op.c renamed from op.c.orig +5 -2
@@ -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)
$NetBSD: patch-ay,v 1.7 2007/05/21 20:24:48 xtraeme Exp $
block-raw-posix.c renamed from block-raw-posix.c.orig +37 -0
@@ -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,
$NetBSD: patch-ba,v 1.1 2007/12/24 10:18:22 apb Exp $
pcspk.c renamed from pcspk.c.orig +19 -3
@@ -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)