From owner-freebsd-ports@FreeBSD.ORG Mon Jul 25 22:26:13 2005 Return-Path: X-Original-To: ports@FreeBSD.org Delivered-To: freebsd-ports@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BD52416A420; Mon, 25 Jul 2005 22:26:13 +0000 (GMT) (envelope-from jkim@FreeBSD.org) Received: from anuket.mj.niksun.com (gwnew.niksun.com [65.115.46.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 680F543D58; Mon, 25 Jul 2005 22:26:09 +0000 (GMT) (envelope-from jkim@FreeBSD.org) Received: from niksun.com (anuket [10.70.0.5]) by anuket.mj.niksun.com (8.13.1/8.13.1) with ESMTP id j6PMSLHG036444; Mon, 25 Jul 2005 18:28:21 -0400 (EDT) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-amd64@FreeBSD.org Date: Mon, 25 Jul 2005 18:25:50 -0400 User-Agent: KMail/1.6.2 References: <20050725222608.A42815@saturn.kn-bremen.de> In-Reply-To: <20050725222608.A42815@saturn.kn-bremen.de> MIME-Version: 1.0 Content-Disposition: inline Content-Type: Multipart/Mixed; boundary="Boundary-00=_vbW5CTfX8oQ8HhB" Message-Id: <200507251825.51540.jkim@FreeBSD.org> X-Virus-Scanned: ClamAV 0.85.1/992/Mon Jul 25 17:48:49 2005 on anuket.mj.niksun.com X-Virus-Status: Clean Cc: ports@FreeBSD.org, freebsd-emulation@FreeBSD.org, Juergen Lock Subject: Re: need help with kqemu X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2005 22:26:14 -0000 --Boundary-00=_vbW5CTfX8oQ8HhB Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Monday 25 July 2005 04:26 pm, Juergen Lock wrote: > Hi! > > Fabrice has released a new version of kqemu that now also > supports amd64 hosts, but as he doesnt know FreeBSD (and my > kernel foo is far from being good enough, neither do i have > an amd64 box) we need someone to port the wrapper to amd64. > Actually the i386 wrapper he has now added to the release > (kqemu-0.7.1.tar.gz) doesnt work either (not sure what happened > there, it doesnt even build), so we need someone to fix/update > that as well. I have made an update for the port that can be > used as a template (only non-kqemu build works), I'll append it > below: > > Removed files: files/BSDmakefile files/kmod_bsd.c > New files: files/kqemu-Makefile-patch files/patch-libmath2 > files/patch-vl.c > > (btw patch-vl.c is from Andrey V. Elsukov, it enables kernel > debugging via virtual serial console, as posted on -ports: > > # qemu -hda disk.img -cdrom 6.0-BETA1.iso -serial pty > # gdb > (gdb) target remote /dev/ptyp0 > ....) Try the attachment. It seems to build and work on amd64 now, including kqemu. Thanks! Jung-uk Kim --Boundary-00=_vbW5CTfX8oQ8HhB Content-Type: text/x-diff; charset="iso-8859-1"; name="qemu.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="qemu.diff" Index: Makefile =================================================================== RCS file: /home/ncvs/ports/emulators/qemu/Makefile,v retrieving revision 1.27 diff -u -r1.27 Makefile --- Makefile 19 Jul 2005 06:06:56 -0000 1.27 +++ Makefile 25 Jul 2005 22:16:33 -0000 @@ -6,12 +6,9 @@ # PORTNAME= qemu -PORTVERSION= 0.7.0s.20050717 +PORTVERSION= 0.7.1 CATEGORIES= emulators -MASTER_SITES= http://www.qemu.org/ \ - http://people.fruitsalad.org/nox/qemu/ \ - http://dad-answers.com/qemu/ -DISTNAME= ${PORTNAME}-snapshot-2005-07-17_23 +MASTER_SITES= http://www.qemu.org/ EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX} MAINTAINER= nox@jelal.kn-bremen.de @@ -23,12 +20,12 @@ .endif .if defined(WITH_KQEMU) -DISTKQEMU= kqemu-0.6.2-1.tar.gz +DISTKQEMU= kqemu-0.7.1.tar.gz DISTFILES= ${EXTRACT_ONLY} ${DISTKQEMU} +EXTRA_PATCHES= ${FILESDIR}/kqemu-freebsd-patch .endif HAS_CONFIGURE= yes -USE_BZIP2= yes USE_GMAKE= yes USE_GETOPT_LONG= yes USE_SDL= sdl @@ -40,9 +37,11 @@ ONLY_FOR_ARCHS= amd64 i386 .if defined(WITH_KQEMU) NO_PACKAGE= Depends on kernel, and module not redistributable +CONFIGURE_ARGS+= --enable-kqemu PLIST_SUB= WITH_KQEMU="" PLIST_SUB+= KMODDIR=${KMODDIR} .else +CONFIGURE_ARGS+= --disable-kqemu PLIST_SUB= WITH_KQEMU="@comment " .endif @@ -52,7 +51,7 @@ .if ${ARCH} == "amd64" ARCH= x86_64 -.if ${OSVERSION} >= 502126 +.if ${OSVERSION} >= 502126 && ${OSVERSION} <= 600029 BUILD_DEPENDS+= gcc34:${PORTSDIR}/lang/gcc34 GCCVERSION= 030402 CC= gcc34 @@ -63,16 +62,12 @@ USE_GCC= 3.4 .endif -.if defined(WITH_KQEMU) && ${ARCH} != "i386" -IGNORE= kqemu only supported on i386 -.endif - .if defined(WITH_KQEMU) && !exists(${SRC_BASE}/sys/Makefile) IGNORE= kqemu requires kernel source to be installed .endif pre-everything:: -.if !defined(WITH_KQEMU) && ${ARCH} == "i386" +.if !defined(WITH_KQEMU) @${ECHO_MSG} "Notice: you can build qemu with the (alpha!) kqemu accelerator kernel module" @${ECHO_MSG} "by defining WITH_KQEMU." .endif @@ -85,7 +80,7 @@ .if defined(WITH_KQEMU) post-extract: @cd ${WRKSRC} && ${TAR} xfz ${_DISTDIR}/${DISTKQEMU} - @${CP} ${FILESDIR}/BSDmakefile ${FILESDIR}/kmod_bsd.c ${WRKSRC}/kqemu + @${LN} -s Makefile.freebsd ${WRKSRC}/kqemu/BSDmakefile .endif pre-patch: Index: distinfo =================================================================== RCS file: /home/ncvs/ports/emulators/qemu/distinfo,v retrieving revision 1.20 diff -u -r1.20 distinfo --- distinfo 19 Jul 2005 06:06:56 -0000 1.20 +++ distinfo 25 Jul 2005 22:16:33 -0000 @@ -1,4 +1,4 @@ -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 +MD5 (qemu-0.7.1.tar.gz) = b0c80d2c082049a5b8ccbc7f55fe165b +SIZE (qemu-0.7.1.tar.gz) = 1338521 +MD5 (kqemu-0.7.1.tar.gz) = 8fc7967492b2157521198f6639218420 +SIZE (kqemu-0.7.1.tar.gz) = 76135 Index: files/patch-fbsd =================================================================== RCS file: /home/ncvs/ports/emulators/qemu/files/patch-fbsd,v retrieving revision 1.2 diff -u -r1.2 patch-fbsd --- files/patch-fbsd 5 May 2005 12:41:10 -0000 1.2 +++ files/patch-fbsd 25 Jul 2005 22:16:33 -0000 @@ -13,7 +13,7 @@ $(MAKE) -C kqemu -f Makefile.winnt else - $(MAKE) -C kqemu -+ cd kqemu && $(BSD_MAKE) ++ ( cd kqemu && $(BSD_MAKE) ) endif endif --- files/kqemu-freebsd-patch Mon Jul 25 18:11:00 2005 +++ files/kqemu-freebsd-patch Mon Jul 25 18:04:37 2005 @@ -0,0 +1,50 @@ +--- qemu/configure.orig Mon Jul 25 17:58:33 2005 ++++ qemu/configure Mon Jul 25 17:59:55 2005 +@@ -99,7 +99,7 @@ + FreeBSD) + bsd="yes" + oss="yes" +-if [ "$cpu" = "i386" ] ; then ++if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then + kqemu="yes" + fi + ;; +--- qemu/kqemu/Makefile.freebsd.orig Sun Apr 17 13:21:31 2005 ++++ qemu/kqemu/Makefile.freebsd Mon Jul 25 17:32:48 2005 +@@ -1,6 +1,11 @@ + # $Id: Makefile.freebsd,v 1.1 2005/04/17 17:21:31 bellard Exp $ + KMOD= kqemu +-SRCS= kmod-freebsd.c ++SRCS= kqemu-freebsd.c ++.if ${MACHINE_ARCH} == "i386" + OBJS= kqemu-mod-i386.o ++.elif ${MACHINE_ARCH} == "amd64" ++OBJS= kqemu-mod-x86_64.o ++.endif ++WERROR= + + .include +--- qemu/kqemu/kqemu-freebsd.c.orig Mon Apr 25 18:14:40 2005 ++++ qemu/kqemu/kqemu-freebsd.c Mon Jul 25 17:40:17 2005 +@@ -59,9 +59,9 @@ + // printf("kqemu_unlock_user_page(%08lx)\n", page_index); + va = (vm_offset_t)page; + ret = vm_map_unwire(&vm->vm_map, va, va+PAGE_SIZE, VM_MAP_WIRE_USER); +- if (ret != KERN_SUCCESS) { +- printf("kqemu_unlock_user_page(%08lx) failed, ret=%d\n", page_index, ret); +- } ++ // if (ret != KERN_SUCCESS) { ++ // printf("kqemu_unlock_user_page(%08lx) failed, ret=%d\n", page_index, ret); ++ // } + } + + /* +@@ -88,7 +88,7 @@ + + void CDECL kqemu_free_page(struct kqemu_page *page) + { +- printf("kqemu_free_page(%08lx)\n", page_index); ++ // printf("kqemu_free_page(%08lx)\n", page_index); + /* XXX: do it */ + } + --- files/patch-libmath2 Mon Jul 25 18:11:00 2005 +++ files/patch-libmath2 Mon Jul 25 16:54:12 2005 @@ -0,0 +1,67 @@ +Index: qemu/bsd/Makefile +@@ -16,7 +16,8 @@ + ${MACHINE_ARCH}/s_rintl.c \ + ${MACHINE_ARCH}/s_round.c \ + ${MACHINE_ARCH}/s_sinl.S \ +- ${MACHINE_ARCH}/s_tanl.S ++ ${MACHINE_ARCH}/s_tanl.S \ ++ ${MACHINE_ARCH}/s_ldexpl.c + + OBJS= ${SRCS:R:S/$/.o/} + +Index: qemu/bsd/i386/s_ldexpl.c +@@ -0,0 +1,21 @@ ++#include ++#include ++#include ++ ++long double __ldexpl(long double x, int expn) ++{ ++ long double res; ++ if (!isfinite (x) || x == 0.0L) ++ return x; ++ ++ __asm__ ("fscale" ++ : "=t" (res) ++ : "0" (x), "u" ((long double) expn)); ++ ++ if (!isfinite (res) || res == 0.0L) ++ errno = ERANGE; ++ ++ return res; ++} ++ ++weak_alias(__ldexpl,ldexpl) +Index: qemu/bsd/amd64/s_ldexpl.c +@@ -0,0 +1,21 @@ ++#include ++#include ++#include ++ ++long double __ldexpl(long double x, int expn) ++{ ++ long double res; ++ if (!isfinite (x) || x == 0.0L) ++ return x; ++ ++ __asm__ ("fscale" ++ : "=t" (res) ++ : "0" (x), "u" ((long double) expn)); ++ ++ if (!isfinite (res) || res == 0.0L) ++ errno = ERANGE; ++ ++ return res; ++} ++ ++weak_alias(__ldexpl,ldexpl) +Index: qemu/target-i386/helper.c +@@ -2886,6 +2886,8 @@ + ST0 = floatx_round_to_int(ST0, &env->fp_status); + } + ++long double ldexpl(long double, int); ++ + void helper_fscale(void) + { + ST0 = ldexp (ST0, (int)(ST1)); --- files/patch-vl.c Mon Jul 25 18:11:00 2005 +++ files/patch-vl.c Mon Jul 25 16:54:12 2005 @@ -0,0 +1,21 @@ +Index: qemu/vl.c +@@ -40,6 +40,10 @@ + #include + #include + #include ++#ifdef __FreeBSD__ ++#include ++#include ++#endif + #ifdef _BSD + #include + #ifndef __APPLE__ +@@ -1280,7 +1284,7 @@ + return chr; + } + +-#if defined(__linux__) ++#if defined(__linux__) || defined(__FreeBSD__) + CharDriverState *qemu_chr_open_pty(void) + { + char slave_name[1024]; --Boundary-00=_vbW5CTfX8oQ8HhB--