diff options
Diffstat (limited to 'emulators')
-rw-r--r-- | emulators/qemu-devel/Makefile | 7 | ||||
-rw-r--r-- | emulators/qemu-devel/distinfo | 4 | ||||
-rw-r--r-- | emulators/qemu-devel/files/BSDmakefile | 9 | ||||
-rw-r--r-- | emulators/qemu-devel/files/kmod_bsd.c | 111 | ||||
-rw-r--r-- | emulators/qemu-devel/files/kqemu-patch | 69 | ||||
-rw-r--r-- | emulators/qemu-devel/files/patch-slirp | 198 | ||||
-rw-r--r-- | emulators/qemu-devel/pkg-descr | 2 | ||||
-rw-r--r-- | emulators/qemu-devel/pkg-plist | 2 | ||||
-rw-r--r-- | emulators/qemu/Makefile | 7 | ||||
-rw-r--r-- | emulators/qemu/distinfo | 4 | ||||
-rw-r--r-- | emulators/qemu/files/BSDmakefile | 9 | ||||
-rw-r--r-- | emulators/qemu/files/kmod_bsd.c | 111 | ||||
-rw-r--r-- | emulators/qemu/files/kqemu-patch | 69 | ||||
-rw-r--r-- | emulators/qemu/files/patch-slirp | 198 | ||||
-rw-r--r-- | emulators/qemu/pkg-descr | 2 | ||||
-rw-r--r-- | emulators/qemu/pkg-plist | 2 |
16 files changed, 212 insertions, 592 deletions
diff --git a/emulators/qemu-devel/Makefile b/emulators/qemu-devel/Makefile index 100f1bc26700..318df652d3ed 100644 --- a/emulators/qemu-devel/Makefile +++ b/emulators/qemu-devel/Makefile @@ -6,12 +6,12 @@ # PORTNAME= qemu -PORTVERSION= 0.7.0s.20050528 +PORTVERSION= 0.7.0s.20050717 CATEGORIES= emulators MASTER_SITES= http://www.qemu.org/ \ http://people.fruitsalad.org/nox/qemu/ \ http://dad-answers.com/qemu/ -DISTNAME= ${PORTNAME}-snapshot-2005-05-28_23 +DISTNAME= ${PORTNAME}-snapshot-2005-07-17_23 EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX} MAINTAINER= nox@jelal.kn-bremen.de @@ -42,7 +42,6 @@ ONLY_FOR_ARCHS= amd64 i386 NO_PACKAGE= Depends on kernel, and module not redistributable PLIST_SUB= WITH_KQEMU="" PLIST_SUB+= KMODDIR=${KMODDIR} -EXTRA_PATCHES= ${FILESDIR}/kqemu-patch .else PLIST_SUB= WITH_KQEMU="@comment " .endif @@ -86,7 +85,7 @@ pre-everything:: .if defined(WITH_KQEMU) post-extract: @cd ${WRKSRC} && ${TAR} xfz ${_DISTDIR}/${DISTKQEMU} - @${CP} ${FILESDIR}/kmod_bsd.c ${WRKSRC}/kqemu + @${CP} ${FILESDIR}/BSDmakefile ${FILESDIR}/kmod_bsd.c ${WRKSRC}/kqemu .endif pre-patch: diff --git a/emulators/qemu-devel/distinfo b/emulators/qemu-devel/distinfo index a6120983bc64..b687e572108a 100644 --- a/emulators/qemu-devel/distinfo +++ b/emulators/qemu-devel/distinfo @@ -1,4 +1,4 @@ -MD5 (qemu-snapshot-2005-05-28_23.tar.bz2) = f232843519396178b921676475d49615 -SIZE (qemu-snapshot-2005-05-28_23.tar.bz2) = 1020104 +MD5 (qemu-snapshot-2005-07-17_23.tar.bz2) = 5d21295c1f328ea00de19a54715ee7c3 +SIZE (qemu-snapshot-2005-07-17_23.tar.bz2) = 1114748 MD5 (kqemu-0.6.2-1.tar.gz) = c6bb3b40fb3d526d731eb0f1f9dee7ee SIZE (kqemu-0.6.2-1.tar.gz) = 21002 diff --git a/emulators/qemu-devel/files/BSDmakefile b/emulators/qemu-devel/files/BSDmakefile new file mode 100644 index 000000000000..41be88583cda --- /dev/null +++ b/emulators/qemu-devel/files/BSDmakefile @@ -0,0 +1,9 @@ +KMOD= kqemu +SRCS= kmod_bsd.c +OBJS= kqemu-mod-i386.o +.if ${OSVERSION} >= 500000 +CC= cc +.endif +WERROR= + +.include <bsd.kmod.mk> diff --git a/emulators/qemu-devel/files/kmod_bsd.c b/emulators/qemu-devel/files/kmod_bsd.c index 63e1cf5053d8..9e51b7cedf89 100644 --- a/emulators/qemu-devel/files/kmod_bsd.c +++ b/emulators/qemu-devel/files/kmod_bsd.c @@ -284,6 +284,10 @@ void CDECL kqemu_log(const char *fmt, ...) #define KQEMU_MAX_INSTANCES 4 struct kqemu_instance { +#if __FreeBSD_version > 500000 + TAILQ_ENTRY(kqemu_instance) kqemu_ent; + struct cdev *kqemu_dev; +#endif struct kqemu_state *state; }; @@ -292,7 +296,9 @@ static int max_locked_pages; #if __FreeBSD_version < 500000 static dev_t kqemu_dev; #else -static struct cdev *kqemu_dev; +static struct clonedevs *kqemuclones; +static TAILQ_HEAD(,kqemu_instance) kqemuhead = TAILQ_HEAD_INITIALIZER(kqemuhead); +static eventhandler_tag clonetag; #endif @@ -322,9 +328,67 @@ static struct cdevsw kqemu_cdevsw = { .d_close = kqemu_close, .d_ioctl = kqemu_ioctl, .d_name = "kqemu", +#ifdef D_NEEDGIANT + .d_flags = D_NEEDGIANT, +#endif #endif }; +#if __FreeBSD_version > 500000 +static void +kqemu_clone(void *arg, char *name, int namelen, struct cdev **dev) +{ + int unit, r; + if (*dev != NULL) + return; + + if (strcmp(name, "kqemu") == 0) + unit = -1; + else if (dev_stdclone(name, NULL, "kqemu", &unit) != 1) + return; /* Bad name */ + if (unit != -1 && unit > KQEMU_MAX_INSTANCES) + return; + + r = clone_create(&kqemuclones, &kqemu_cdevsw, &unit, dev, 0); + if (r) { + *dev = make_dev(&kqemu_cdevsw, unit2minor(unit), + UID_ROOT, GID_WHEEL, 0660, "kqemu%d", unit); + if (*dev != NULL) { + dev_ref(*dev); + (*dev)->si_flags |= SI_CHEAPCLONE; + } + } +} +#endif + +static void kqemu_destroy(struct kqemu_instance *ks) +{ + struct cdev *dev = ks->kqemu_dev; + + if (ks->state) { + kqemu_delete(ks->state); + ks->state = NULL; + } + + free(ks, M_KQEMU); + dev->si_drv1 = NULL; +#if __FreeBSD_version > 500000 + mtx_lock_spin(&cache_lock); + TAILQ_REMOVE(&kqemuhead, ks, kqemu_ent); +#endif + if (!--kqemu_ref_count) { + int i; + for (i = 1023; i >= 0; i--) + kqemu_vfree(pagecache[i]); + memset(pagecache, 0, 1024 * sizeof(void *)); + } +#if __FreeBSD_version > 500000 + mtx_unlock_spin(&cache_lock); + + destroy_dev(dev); +#endif +} + int #if __FreeBSD_version < 500000 kqemu_open(dev, flags, fmt, p) @@ -355,7 +419,9 @@ kqemu_open(dev, flags, fmt, td) dev->si_drv1 = ks; #if __FreeBSD_version > 500000 + ks->kqemu_dev = dev; mtx_lock_spin(&cache_lock); + TAILQ_INSERT_TAIL(&kqemuhead, ks, kqemu_ent); #endif kqemu_ref_count++; #if __FreeBSD_version > 500000 @@ -382,25 +448,8 @@ kqemu_close(dev, flags, fmt, td) #endif struct kqemu_instance *ks = (struct kqemu_instance *) dev->si_drv1; - if (ks->state) { - kqemu_delete(ks->state); - ks->state = NULL; - } - - free(ks, M_KQEMU); - dev->si_drv1 = NULL; -#if __FreeBSD_version > 500000 - mtx_lock_spin(&cache_lock); -#endif - if (!--kqemu_ref_count) { - int i; - for (i = 1023; i >= 0; i--) - kqemu_vfree(pagecache[i]); - memset(pagecache, 0, 1024 * sizeof(void *)); - } -#if __FreeBSD_version > 500000 - mtx_unlock_spin(&cache_lock); -#endif + kqemu_destroy(ks); + kqemu_log("closed by pid=%d\n", p->p_pid); return(0); } @@ -513,9 +562,14 @@ init_module(void) kqemu_log("error registering cdevsw, rc=%d\n", rc); return(ENOENT); } -#endif kqemu_dev = make_dev(&kqemu_cdevsw, 0, UID_ROOT, GID_WHEEL, 0660, "kqemu"); +#else + clone_setup(&kqemuclones); + clonetag = EVENTHANDLER_REGISTER(dev_clone, kqemu_clone, 0, 1000); + if (!clonetag) + return ENOMEM; +#endif kqemu_log("KQEMU installed, max_instances=%d max_locked_mem=%dkB.\n", KQEMU_MAX_INSTANCES, max_locked_pages * 4); @@ -529,12 +583,25 @@ cleanup_module(void) { #if __FreeBSD_version < 500000 int rc; +#else + struct kqemu_instance *ks; #endif - destroy_dev(kqemu_dev); #if __FreeBSD_version < 500000 + destroy_dev(kqemu_dev); if ((rc = cdevsw_remove(&kqemu_cdevsw))) kqemu_log("error unregistering, rc=%d\n", rc); +#else + EVENTHANDLER_DEREGISTER(dev_clone, clonetag); + mtx_lock_spin(&cache_lock); + while ((ks = TAILQ_FIRST(&kqemuhead)) != NULL) { + mtx_unlock_spin(&cache_lock); + kqemu_destroy(ks); + mtx_lock_spin(&cache_lock); + } + mtx_unlock_spin(&cache_lock); + mtx_destroy(&cache_lock); + clone_cleanup(&kqemuclones); #endif kqemu_vfree(pagecache); diff --git a/emulators/qemu-devel/files/kqemu-patch b/emulators/qemu-devel/files/kqemu-patch deleted file mode 100644 index ae0064ba3be7..000000000000 --- a/emulators/qemu-devel/files/kqemu-patch +++ /dev/null @@ -1,69 +0,0 @@ -Index: qemu/kqemu/Makefile -@@ -1,62 +1,6 @@ --ifeq ($(PATCHLEVEL),) --# compile in kqemu directory -+KMOD= kqemu -+SRCS= kmod_bsd.c -+OBJS= kqemu-mod-i386.o -+WERROR= - ---include ../config-host.mak -- --ifdef CONFIG_KBUILD26 --# 2.6 build -- --all: kqemu.ko -- --kqemu.ko: -- make -C $(KERNEL_PATH) M=`pwd` modules -- --else --# 2.4 build -- --all: kqemu.o -- --kqemu.o: -- make -C $(KERNEL_PATH) SUBDIRS=`pwd` modules -- --endif # !CONFIG_KBUILD26 -- --clean: -- rm -f kqemu.o kqemu.ko kmod.o kqemu-mod.o kqemu.mod.c *~ -- --FILES=Makefile README LICENSE install.sh kmod.c kqemu.h kqemu-mod-i386.o \ -- kqemu-doc.texi kqemu-doc.html --VERSION=0.6.2 -- --tar: -- cd .. ; tar zcvf /tmp/kqemu-$(VERSION).tar.gz $(addprefix kqemu/, $(FILES)) -- --# documentation --doc: kqemu-doc.html -- --%.html: %.texi -- texi2html -monolithic -number $< -- --else -- --ifeq ($(PATCHLEVEL),4) --# called from 2.4 kernel kbuild -- --obj-m:= kqemu.o --kqemu-objs:= kmod.o kqemu-mod-i386.o -- --include $(TOPDIR)/Rules.make -- --kqemu.o: $(kqemu-objs) -- $(LD) -r -o $@ $(kqemu-objs) -- --else --# called from 2.6 kernel kbuild -- --obj-m:= kqemu.o --kqemu-objs:= kmod.o kqemu-mod.o -- --$(obj)/kqemu-mod.o: $(src)/kqemu-mod-i386.o -- cp $< $@ --endif --endif # PATCHLEVEL -+.include <bsd.kmod.mk> diff --git a/emulators/qemu-devel/files/patch-slirp b/emulators/qemu-devel/files/patch-slirp deleted file mode 100644 index 6bf955431495..000000000000 --- a/emulators/qemu-devel/files/patch-slirp +++ /dev/null @@ -1,198 +0,0 @@ -From: gbeauchesne@mandriva.com (Gwenole Beauchesne) -Subject: [Qemu-devel] [PATCH] slirp 64-bit fixes -Date: Tue, 17 May 2005 23:46:40 +0000 (UTC) - -Hi, - -Here are some 64-bit fixes to slirp. Tested on x86_64 as -user-net with a -single FTP transaction. You may not need all hunks though. - -2005-05-15 Gwenole Beauchesne <gbeauchesne@mandriva.com> - - * Merge slirp 64-bit fixes from Basilisk II tree. - ---- qemu-0.7.0/slirp/bootp.c.slirp-64bit-fixes 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/slirp/bootp.c 2005-05-17 07:29:29.000000000 +0200 -@@ -238,7 +238,7 @@ static void bootp_reply(struct bootp_t * - - void bootp_input(struct mbuf *m) - { -- struct bootp_t *bp = (struct bootp_t *)m->m_data; -+ struct bootp_t *bp = mtod(m, struct bootp_t *); - - if (bp->bp_op == BOOTP_REQUEST) { - bootp_reply(bp); ---- qemu-0.7.0/slirp/bootp.h.slirp-64bit-fixes 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/slirp/bootp.h 2005-05-17 07:29:29.000000000 +0200 -@@ -97,9 +97,9 @@ struct bootp_t { - uint8_t bp_htype; - uint8_t bp_hlen; - uint8_t bp_hops; -- unsigned long bp_xid; -- unsigned short bp_secs; -- unsigned short unused; -+ uint32_t bp_xid; -+ uint16_t bp_secs; -+ uint16_t unused; - struct in_addr bp_ciaddr; - struct in_addr bp_yiaddr; - struct in_addr bp_siaddr; ---- qemu-0.7.0/slirp/ip_icmp.h.slirp-64bit-fixes 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/slirp/ip_icmp.h 2005-05-17 07:29:29.000000000 +0200 -@@ -83,8 +83,8 @@ struct icmp { - struct ip idi_ip; - /* options and then 64 bits of data */ - } id_ip; -- u_long id_mask; -- char id_data[1]; -+ uint32_t id_mask; -+ char id_data[1]; - } icmp_dun; - #define icmp_otime icmp_dun.id_ts.its_otime - #define icmp_rtime icmp_dun.id_ts.its_rtime ---- qemu-0.7.0/slirp/libslirp.h.slirp-64bit-fixes 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/slirp/libslirp.h 2005-05-17 07:29:29.000000000 +0200 -@@ -9,6 +9,10 @@ int inet_aton(const char *cp, struct in_ - #include <arpa/inet.h> - #endif - -+#ifdef __cplusplus -+extern "C" { -+#endif -+ - void slirp_init(void); - - void slirp_select_fill(int *pnfds, -@@ -29,4 +33,8 @@ int slirp_add_exec(int do_pty, const cha - - extern const char *tftp_prefix; - -+#ifdef __cplusplus -+} -+#endif -+ - #endif ---- qemu-0.7.0/slirp/udp.c.slirp-64bit-fixes 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/slirp/udp.c 2005-05-17 07:29:29.000000000 +0200 -@@ -420,10 +420,16 @@ struct talk_request { - #endif - - struct cu_header { -- char dest[8]; -- short family; -- u_short port; -- u_long addr; -+ uint16_t d_family; // destination family -+ uint16_t d_port; // destination port -+ uint32_t d_addr; // destination address -+ uint16_t s_family; // source family -+ uint16_t s_port; // source port -+ uint32_t s_addr; // source address -+ uint32_t seqn; // sequence number -+ uint16_t message; // message -+ uint16_t data_type; // data type -+ uint16_t pkt_len; // packet length - } *cu_head; - - switch(so->so_emu) { -@@ -610,8 +616,8 @@ struct cu_header { - if (getsockname(so->s, (struct sockaddr *)&addr, &addrlen) < 0) - return; - cu_head = mtod(m, struct cu_header *); -- cu_head->port = addr.sin_port; -- cu_head->addr = (u_long) our_addr.s_addr; -+ cu_head->s_port = addr.sin_port; -+ cu_head->s_addr = our_addr.s_addr; - } - - return; ---- qemu-0.7.0/slirp/udp.h.slirp-64bit-fixes 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/slirp/udp.h 2005-05-17 07:29:29.000000000 +0200 -@@ -94,6 +94,7 @@ struct udpstat { - - extern struct udpstat udpstat; - extern struct socket udb; -+struct mbuf; - - void udp_init _P((void)); - void udp_input _P((register struct mbuf *, int)); ---- qemu-0.7.0/slirp/slirp_config.h.slirp-64bit-fixes 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/slirp/slirp_config.h 2005-05-17 08:00:23.000000000 +0200 -@@ -85,9 +85,6 @@ - /* Define if you have sys/bitypes.h */ - #undef HAVE_SYS_BITYPES_H - --/* Define if the machine is big endian */ --//#undef WORDS_BIGENDIAN -- - /* Define if your sprintf returns char * instead of int */ - #undef BAD_SPRINTF - -@@ -139,19 +136,6 @@ - /* Define if you don't have u_int32_t etc. typedef'd */ - #undef NEED_TYPEDEFS - --/* Define to sizeof(char) */ --#define SIZEOF_CHAR 1 -- --/* Define to sizeof(short) */ --#define SIZEOF_SHORT 2 -- --/* Define to sizeof(int) */ --#define SIZEOF_INT 4 -- --/* Define to sizeof(char *) */ --/* XXX: patch it */ --#define SIZEOF_CHAR_P 4 -- - /* Define if you have random() */ - #undef HAVE_RANDOM - ---- qemu-0.7.0/configure.slirp-64bit-fixes 2005-05-17 07:05:18.000000000 +0200 -+++ qemu-0.7.0/configure 2005-05-17 08:04:55.000000000 +0200 -@@ -614,6 +614,36 @@ if [ "$bsd" = "yes" ] ; then - echo "#define _BSD 1" >> $config_h - fi - -+# detect type sizes for slirp -+for type in char short int char_p; do -+ case $type in -+ *_p) c_type="`echo $type | sed -e 's/_p//'` *";; -+ *) c_type=$type;; -+ esac -+ d_type="SIZEOF_`echo $type | tr '[:lower:]' '[:upper:]'`" -+ d_size= -+ for size in 1 2 4 8 16; do -+ cat >$TMPC << EOF -+int main(void) -+{ -+ static int test_array[1 - 2 * !(((long)(sizeof($c_type))) == $size)]; -+ test_array[0] = 0; -+ return 0; -+} -+EOF -+ if $cc -o $TMPO -c $TMPC 2>/dev/null; then -+ d_size=$size -+ break; -+ fi -+ done -+ rm -f $TMPC $TMPO $TMPE -+ if test -n "$d_size"; then -+ echo "#define $d_type $d_size" >> $config_h -+ else -+ echo "#error \"undefined $d_type\"" >> $config_h -+ fi -+done -+ - for target in $target_list; do - - target_dir="$target" - - -_______________________________________________ -Qemu-devel mailing list -Qemu-devel@nongnu.org -http://lists.nongnu.org/mailman/listinfo/qemu-devel - - - diff --git a/emulators/qemu-devel/pkg-descr b/emulators/qemu-devel/pkg-descr index 40c482e1bc33..5dbc48de3ce5 100644 --- a/emulators/qemu-devel/pkg-descr +++ b/emulators/qemu-devel/pkg-descr @@ -14,7 +14,7 @@ cross-debugging. As QEMU requires no host kernel patches to run, it is very safe and easy to use. (but kqemu is now also supported for the i386 on i386 case) -See also the preconfigured system images on http://www.freeoszoo.org/ +See also the preconfigured system images on http://oszoo.org/ Many live cd isos also work. WWW: http://fabrice.bellard.free.fr/qemu/ diff --git a/emulators/qemu-devel/pkg-plist b/emulators/qemu-devel/pkg-plist index 129ae46415a7..9d69baa00b0e 100644 --- a/emulators/qemu-devel/pkg-plist +++ b/emulators/qemu-devel/pkg-plist @@ -1,5 +1,6 @@ bin/qemu bin/qemu-img +bin/qemu-system-mips bin/qemu-system-ppc bin/qemu-system-sparc bin/qemu-system-x86_64 @@ -11,6 +12,7 @@ share/qemu/vgabios.bin share/qemu/vgabios-cirrus.bin share/qemu/ppc_rom.bin share/qemu/proll.elf +share/qemu/video.x share/qemu/keymaps/ar share/qemu/keymaps/common share/qemu/keymaps/da diff --git a/emulators/qemu/Makefile b/emulators/qemu/Makefile index 100f1bc26700..318df652d3ed 100644 --- a/emulators/qemu/Makefile +++ b/emulators/qemu/Makefile @@ -6,12 +6,12 @@ # PORTNAME= qemu -PORTVERSION= 0.7.0s.20050528 +PORTVERSION= 0.7.0s.20050717 CATEGORIES= emulators MASTER_SITES= http://www.qemu.org/ \ http://people.fruitsalad.org/nox/qemu/ \ http://dad-answers.com/qemu/ -DISTNAME= ${PORTNAME}-snapshot-2005-05-28_23 +DISTNAME= ${PORTNAME}-snapshot-2005-07-17_23 EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX} MAINTAINER= nox@jelal.kn-bremen.de @@ -42,7 +42,6 @@ ONLY_FOR_ARCHS= amd64 i386 NO_PACKAGE= Depends on kernel, and module not redistributable PLIST_SUB= WITH_KQEMU="" PLIST_SUB+= KMODDIR=${KMODDIR} -EXTRA_PATCHES= ${FILESDIR}/kqemu-patch .else PLIST_SUB= WITH_KQEMU="@comment " .endif @@ -86,7 +85,7 @@ pre-everything:: .if defined(WITH_KQEMU) post-extract: @cd ${WRKSRC} && ${TAR} xfz ${_DISTDIR}/${DISTKQEMU} - @${CP} ${FILESDIR}/kmod_bsd.c ${WRKSRC}/kqemu + @${CP} ${FILESDIR}/BSDmakefile ${FILESDIR}/kmod_bsd.c ${WRKSRC}/kqemu .endif pre-patch: diff --git a/emulators/qemu/distinfo b/emulators/qemu/distinfo index a6120983bc64..b687e572108a 100644 --- a/emulators/qemu/distinfo +++ b/emulators/qemu/distinfo @@ -1,4 +1,4 @@ -MD5 (qemu-snapshot-2005-05-28_23.tar.bz2) = f232843519396178b921676475d49615 -SIZE (qemu-snapshot-2005-05-28_23.tar.bz2) = 1020104 +MD5 (qemu-snapshot-2005-07-17_23.tar.bz2) = 5d21295c1f328ea00de19a54715ee7c3 +SIZE (qemu-snapshot-2005-07-17_23.tar.bz2) = 1114748 MD5 (kqemu-0.6.2-1.tar.gz) = c6bb3b40fb3d526d731eb0f1f9dee7ee SIZE (kqemu-0.6.2-1.tar.gz) = 21002 diff --git a/emulators/qemu/files/BSDmakefile b/emulators/qemu/files/BSDmakefile new file mode 100644 index 000000000000..41be88583cda --- /dev/null +++ b/emulators/qemu/files/BSDmakefile @@ -0,0 +1,9 @@ +KMOD= kqemu +SRCS= kmod_bsd.c +OBJS= kqemu-mod-i386.o +.if ${OSVERSION} >= 500000 +CC= cc +.endif +WERROR= + +.include <bsd.kmod.mk> diff --git a/emulators/qemu/files/kmod_bsd.c b/emulators/qemu/files/kmod_bsd.c index 63e1cf5053d8..9e51b7cedf89 100644 --- a/emulators/qemu/files/kmod_bsd.c +++ b/emulators/qemu/files/kmod_bsd.c @@ -284,6 +284,10 @@ void CDECL kqemu_log(const char *fmt, ...) #define KQEMU_MAX_INSTANCES 4 struct kqemu_instance { +#if __FreeBSD_version > 500000 + TAILQ_ENTRY(kqemu_instance) kqemu_ent; + struct cdev *kqemu_dev; +#endif struct kqemu_state *state; }; @@ -292,7 +296,9 @@ static int max_locked_pages; #if __FreeBSD_version < 500000 static dev_t kqemu_dev; #else -static struct cdev *kqemu_dev; +static struct clonedevs *kqemuclones; +static TAILQ_HEAD(,kqemu_instance) kqemuhead = TAILQ_HEAD_INITIALIZER(kqemuhead); +static eventhandler_tag clonetag; #endif @@ -322,9 +328,67 @@ static struct cdevsw kqemu_cdevsw = { .d_close = kqemu_close, .d_ioctl = kqemu_ioctl, .d_name = "kqemu", +#ifdef D_NEEDGIANT + .d_flags = D_NEEDGIANT, +#endif #endif }; +#if __FreeBSD_version > 500000 +static void +kqemu_clone(void *arg, char *name, int namelen, struct cdev **dev) +{ + int unit, r; + if (*dev != NULL) + return; + + if (strcmp(name, "kqemu") == 0) + unit = -1; + else if (dev_stdclone(name, NULL, "kqemu", &unit) != 1) + return; /* Bad name */ + if (unit != -1 && unit > KQEMU_MAX_INSTANCES) + return; + + r = clone_create(&kqemuclones, &kqemu_cdevsw, &unit, dev, 0); + if (r) { + *dev = make_dev(&kqemu_cdevsw, unit2minor(unit), + UID_ROOT, GID_WHEEL, 0660, "kqemu%d", unit); + if (*dev != NULL) { + dev_ref(*dev); + (*dev)->si_flags |= SI_CHEAPCLONE; + } + } +} +#endif + +static void kqemu_destroy(struct kqemu_instance *ks) +{ + struct cdev *dev = ks->kqemu_dev; + + if (ks->state) { + kqemu_delete(ks->state); + ks->state = NULL; + } + + free(ks, M_KQEMU); + dev->si_drv1 = NULL; +#if __FreeBSD_version > 500000 + mtx_lock_spin(&cache_lock); + TAILQ_REMOVE(&kqemuhead, ks, kqemu_ent); +#endif + if (!--kqemu_ref_count) { + int i; + for (i = 1023; i >= 0; i--) + kqemu_vfree(pagecache[i]); + memset(pagecache, 0, 1024 * sizeof(void *)); + } +#if __FreeBSD_version > 500000 + mtx_unlock_spin(&cache_lock); + + destroy_dev(dev); +#endif +} + int #if __FreeBSD_version < 500000 kqemu_open(dev, flags, fmt, p) @@ -355,7 +419,9 @@ kqemu_open(dev, flags, fmt, td) dev->si_drv1 = ks; #if __FreeBSD_version > 500000 + ks->kqemu_dev = dev; mtx_lock_spin(&cache_lock); + TAILQ_INSERT_TAIL(&kqemuhead, ks, kqemu_ent); #endif kqemu_ref_count++; #if __FreeBSD_version > 500000 @@ -382,25 +448,8 @@ kqemu_close(dev, flags, fmt, td) #endif struct kqemu_instance *ks = (struct kqemu_instance *) dev->si_drv1; - if (ks->state) { - kqemu_delete(ks->state); - ks->state = NULL; - } - - free(ks, M_KQEMU); - dev->si_drv1 = NULL; -#if __FreeBSD_version > 500000 - mtx_lock_spin(&cache_lock); -#endif - if (!--kqemu_ref_count) { - int i; - for (i = 1023; i >= 0; i--) - kqemu_vfree(pagecache[i]); - memset(pagecache, 0, 1024 * sizeof(void *)); - } -#if __FreeBSD_version > 500000 - mtx_unlock_spin(&cache_lock); -#endif + kqemu_destroy(ks); + kqemu_log("closed by pid=%d\n", p->p_pid); return(0); } @@ -513,9 +562,14 @@ init_module(void) kqemu_log("error registering cdevsw, rc=%d\n", rc); return(ENOENT); } -#endif kqemu_dev = make_dev(&kqemu_cdevsw, 0, UID_ROOT, GID_WHEEL, 0660, "kqemu"); +#else + clone_setup(&kqemuclones); + clonetag = EVENTHANDLER_REGISTER(dev_clone, kqemu_clone, 0, 1000); + if (!clonetag) + return ENOMEM; +#endif kqemu_log("KQEMU installed, max_instances=%d max_locked_mem=%dkB.\n", KQEMU_MAX_INSTANCES, max_locked_pages * 4); @@ -529,12 +583,25 @@ cleanup_module(void) { #if __FreeBSD_version < 500000 int rc; +#else + struct kqemu_instance *ks; #endif - destroy_dev(kqemu_dev); #if __FreeBSD_version < 500000 + destroy_dev(kqemu_dev); if ((rc = cdevsw_remove(&kqemu_cdevsw))) kqemu_log("error unregistering, rc=%d\n", rc); +#else + EVENTHANDLER_DEREGISTER(dev_clone, clonetag); + mtx_lock_spin(&cache_lock); + while ((ks = TAILQ_FIRST(&kqemuhead)) != NULL) { + mtx_unlock_spin(&cache_lock); + kqemu_destroy(ks); + mtx_lock_spin(&cache_lock); + } + mtx_unlock_spin(&cache_lock); + mtx_destroy(&cache_lock); + clone_cleanup(&kqemuclones); #endif kqemu_vfree(pagecache); diff --git a/emulators/qemu/files/kqemu-patch b/emulators/qemu/files/kqemu-patch deleted file mode 100644 index ae0064ba3be7..000000000000 --- a/emulators/qemu/files/kqemu-patch +++ /dev/null @@ -1,69 +0,0 @@ -Index: qemu/kqemu/Makefile -@@ -1,62 +1,6 @@ --ifeq ($(PATCHLEVEL),) --# compile in kqemu directory -+KMOD= kqemu -+SRCS= kmod_bsd.c -+OBJS= kqemu-mod-i386.o -+WERROR= - ---include ../config-host.mak -- --ifdef CONFIG_KBUILD26 --# 2.6 build -- --all: kqemu.ko -- --kqemu.ko: -- make -C $(KERNEL_PATH) M=`pwd` modules -- --else --# 2.4 build -- --all: kqemu.o -- --kqemu.o: -- make -C $(KERNEL_PATH) SUBDIRS=`pwd` modules -- --endif # !CONFIG_KBUILD26 -- --clean: -- rm -f kqemu.o kqemu.ko kmod.o kqemu-mod.o kqemu.mod.c *~ -- --FILES=Makefile README LICENSE install.sh kmod.c kqemu.h kqemu-mod-i386.o \ -- kqemu-doc.texi kqemu-doc.html --VERSION=0.6.2 -- --tar: -- cd .. ; tar zcvf /tmp/kqemu-$(VERSION).tar.gz $(addprefix kqemu/, $(FILES)) -- --# documentation --doc: kqemu-doc.html -- --%.html: %.texi -- texi2html -monolithic -number $< -- --else -- --ifeq ($(PATCHLEVEL),4) --# called from 2.4 kernel kbuild -- --obj-m:= kqemu.o --kqemu-objs:= kmod.o kqemu-mod-i386.o -- --include $(TOPDIR)/Rules.make -- --kqemu.o: $(kqemu-objs) -- $(LD) -r -o $@ $(kqemu-objs) -- --else --# called from 2.6 kernel kbuild -- --obj-m:= kqemu.o --kqemu-objs:= kmod.o kqemu-mod.o -- --$(obj)/kqemu-mod.o: $(src)/kqemu-mod-i386.o -- cp $< $@ --endif --endif # PATCHLEVEL -+.include <bsd.kmod.mk> diff --git a/emulators/qemu/files/patch-slirp b/emulators/qemu/files/patch-slirp deleted file mode 100644 index 6bf955431495..000000000000 --- a/emulators/qemu/files/patch-slirp +++ /dev/null @@ -1,198 +0,0 @@ -From: gbeauchesne@mandriva.com (Gwenole Beauchesne) -Subject: [Qemu-devel] [PATCH] slirp 64-bit fixes -Date: Tue, 17 May 2005 23:46:40 +0000 (UTC) - -Hi, - -Here are some 64-bit fixes to slirp. Tested on x86_64 as -user-net with a -single FTP transaction. You may not need all hunks though. - -2005-05-15 Gwenole Beauchesne <gbeauchesne@mandriva.com> - - * Merge slirp 64-bit fixes from Basilisk II tree. - ---- qemu-0.7.0/slirp/bootp.c.slirp-64bit-fixes 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/slirp/bootp.c 2005-05-17 07:29:29.000000000 +0200 -@@ -238,7 +238,7 @@ static void bootp_reply(struct bootp_t * - - void bootp_input(struct mbuf *m) - { -- struct bootp_t *bp = (struct bootp_t *)m->m_data; -+ struct bootp_t *bp = mtod(m, struct bootp_t *); - - if (bp->bp_op == BOOTP_REQUEST) { - bootp_reply(bp); ---- qemu-0.7.0/slirp/bootp.h.slirp-64bit-fixes 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/slirp/bootp.h 2005-05-17 07:29:29.000000000 +0200 -@@ -97,9 +97,9 @@ struct bootp_t { - uint8_t bp_htype; - uint8_t bp_hlen; - uint8_t bp_hops; -- unsigned long bp_xid; -- unsigned short bp_secs; -- unsigned short unused; -+ uint32_t bp_xid; -+ uint16_t bp_secs; -+ uint16_t unused; - struct in_addr bp_ciaddr; - struct in_addr bp_yiaddr; - struct in_addr bp_siaddr; ---- qemu-0.7.0/slirp/ip_icmp.h.slirp-64bit-fixes 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/slirp/ip_icmp.h 2005-05-17 07:29:29.000000000 +0200 -@@ -83,8 +83,8 @@ struct icmp { - struct ip idi_ip; - /* options and then 64 bits of data */ - } id_ip; -- u_long id_mask; -- char id_data[1]; -+ uint32_t id_mask; -+ char id_data[1]; - } icmp_dun; - #define icmp_otime icmp_dun.id_ts.its_otime - #define icmp_rtime icmp_dun.id_ts.its_rtime ---- qemu-0.7.0/slirp/libslirp.h.slirp-64bit-fixes 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/slirp/libslirp.h 2005-05-17 07:29:29.000000000 +0200 -@@ -9,6 +9,10 @@ int inet_aton(const char *cp, struct in_ - #include <arpa/inet.h> - #endif - -+#ifdef __cplusplus -+extern "C" { -+#endif -+ - void slirp_init(void); - - void slirp_select_fill(int *pnfds, -@@ -29,4 +33,8 @@ int slirp_add_exec(int do_pty, const cha - - extern const char *tftp_prefix; - -+#ifdef __cplusplus -+} -+#endif -+ - #endif ---- qemu-0.7.0/slirp/udp.c.slirp-64bit-fixes 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/slirp/udp.c 2005-05-17 07:29:29.000000000 +0200 -@@ -420,10 +420,16 @@ struct talk_request { - #endif - - struct cu_header { -- char dest[8]; -- short family; -- u_short port; -- u_long addr; -+ uint16_t d_family; // destination family -+ uint16_t d_port; // destination port -+ uint32_t d_addr; // destination address -+ uint16_t s_family; // source family -+ uint16_t s_port; // source port -+ uint32_t s_addr; // source address -+ uint32_t seqn; // sequence number -+ uint16_t message; // message -+ uint16_t data_type; // data type -+ uint16_t pkt_len; // packet length - } *cu_head; - - switch(so->so_emu) { -@@ -610,8 +616,8 @@ struct cu_header { - if (getsockname(so->s, (struct sockaddr *)&addr, &addrlen) < 0) - return; - cu_head = mtod(m, struct cu_header *); -- cu_head->port = addr.sin_port; -- cu_head->addr = (u_long) our_addr.s_addr; -+ cu_head->s_port = addr.sin_port; -+ cu_head->s_addr = our_addr.s_addr; - } - - return; ---- qemu-0.7.0/slirp/udp.h.slirp-64bit-fixes 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/slirp/udp.h 2005-05-17 07:29:29.000000000 +0200 -@@ -94,6 +94,7 @@ struct udpstat { - - extern struct udpstat udpstat; - extern struct socket udb; -+struct mbuf; - - void udp_init _P((void)); - void udp_input _P((register struct mbuf *, int)); ---- qemu-0.7.0/slirp/slirp_config.h.slirp-64bit-fixes 2005-04-27 22:52:05.000000000 +0200 -+++ qemu-0.7.0/slirp/slirp_config.h 2005-05-17 08:00:23.000000000 +0200 -@@ -85,9 +85,6 @@ - /* Define if you have sys/bitypes.h */ - #undef HAVE_SYS_BITYPES_H - --/* Define if the machine is big endian */ --//#undef WORDS_BIGENDIAN -- - /* Define if your sprintf returns char * instead of int */ - #undef BAD_SPRINTF - -@@ -139,19 +136,6 @@ - /* Define if you don't have u_int32_t etc. typedef'd */ - #undef NEED_TYPEDEFS - --/* Define to sizeof(char) */ --#define SIZEOF_CHAR 1 -- --/* Define to sizeof(short) */ --#define SIZEOF_SHORT 2 -- --/* Define to sizeof(int) */ --#define SIZEOF_INT 4 -- --/* Define to sizeof(char *) */ --/* XXX: patch it */ --#define SIZEOF_CHAR_P 4 -- - /* Define if you have random() */ - #undef HAVE_RANDOM - ---- qemu-0.7.0/configure.slirp-64bit-fixes 2005-05-17 07:05:18.000000000 +0200 -+++ qemu-0.7.0/configure 2005-05-17 08:04:55.000000000 +0200 -@@ -614,6 +614,36 @@ if [ "$bsd" = "yes" ] ; then - echo "#define _BSD 1" >> $config_h - fi - -+# detect type sizes for slirp -+for type in char short int char_p; do -+ case $type in -+ *_p) c_type="`echo $type | sed -e 's/_p//'` *";; -+ *) c_type=$type;; -+ esac -+ d_type="SIZEOF_`echo $type | tr '[:lower:]' '[:upper:]'`" -+ d_size= -+ for size in 1 2 4 8 16; do -+ cat >$TMPC << EOF -+int main(void) -+{ -+ static int test_array[1 - 2 * !(((long)(sizeof($c_type))) == $size)]; -+ test_array[0] = 0; -+ return 0; -+} -+EOF -+ if $cc -o $TMPO -c $TMPC 2>/dev/null; then -+ d_size=$size -+ break; -+ fi -+ done -+ rm -f $TMPC $TMPO $TMPE -+ if test -n "$d_size"; then -+ echo "#define $d_type $d_size" >> $config_h -+ else -+ echo "#error \"undefined $d_type\"" >> $config_h -+ fi -+done -+ - for target in $target_list; do - - target_dir="$target" - - -_______________________________________________ -Qemu-devel mailing list -Qemu-devel@nongnu.org -http://lists.nongnu.org/mailman/listinfo/qemu-devel - - - diff --git a/emulators/qemu/pkg-descr b/emulators/qemu/pkg-descr index 40c482e1bc33..5dbc48de3ce5 100644 --- a/emulators/qemu/pkg-descr +++ b/emulators/qemu/pkg-descr @@ -14,7 +14,7 @@ cross-debugging. As QEMU requires no host kernel patches to run, it is very safe and easy to use. (but kqemu is now also supported for the i386 on i386 case) -See also the preconfigured system images on http://www.freeoszoo.org/ +See also the preconfigured system images on http://oszoo.org/ Many live cd isos also work. WWW: http://fabrice.bellard.free.fr/qemu/ diff --git a/emulators/qemu/pkg-plist b/emulators/qemu/pkg-plist index 129ae46415a7..9d69baa00b0e 100644 --- a/emulators/qemu/pkg-plist +++ b/emulators/qemu/pkg-plist @@ -1,5 +1,6 @@ bin/qemu bin/qemu-img +bin/qemu-system-mips bin/qemu-system-ppc bin/qemu-system-sparc bin/qemu-system-x86_64 @@ -11,6 +12,7 @@ share/qemu/vgabios.bin share/qemu/vgabios-cirrus.bin share/qemu/ppc_rom.bin share/qemu/proll.elf +share/qemu/video.x share/qemu/keymaps/ar share/qemu/keymaps/common share/qemu/keymaps/da |