From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K1q62-00028V-AP for qemu-devel@nongnu.org; Thu, 29 May 2008 17:55:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K1q5z-00027R-V8 for qemu-devel@nongnu.org; Thu, 29 May 2008 17:55:41 -0400 Received: from [199.232.76.173] (port=48506 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K1q5z-00027N-PI for qemu-devel@nongnu.org; Thu, 29 May 2008 17:55:39 -0400 Received: from relay1-v.mail.gandi.net ([217.70.178.75]:48884) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K1q5z-0003UJ-D0 for qemu-devel@nongnu.org; Thu, 29 May 2008 17:55:39 -0400 Received: from localhost (mfilter4-v.gandi.net [217.70.178.38]) by relay1-v.mail.gandi.net (Postfix) with ESMTP id BAAAC362AA for ; Thu, 29 May 2008 23:55:38 +0200 (CEST) Received: from relay1-v.mail.gandi.net ([217.70.178.75]) by localhost (mfilter4-v.mgt.gandi.net [217.70.178.38]) (amavisd-new, port 10024) with ESMTP id 6Dz1eR+MSeJW for ; Thu, 29 May 2008 23:55:33 +0200 (CEST) Received: from [84.102.211.115] (115.211.102-84.rev.gaoland.net [84.102.211.115]) by relay1-v.mail.gandi.net (Postfix) with ESMTP id E3601362AF for ; Thu, 29 May 2008 23:55:32 +0200 (CEST) Message-ID: <483F2617.7020900@bellard.org> Date: Thu, 29 May 2008 23:54:31 +0200 From: Fabrice Bellard MIME-Version: 1.0 Subject: Re: [Qemu-devel] osdep.c patch (FreeBSD hosts) References: <20080529214007.GA26341@saturn.kn-bremen.de> In-Reply-To: <20080529214007.GA26341@saturn.kn-bremen.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Is it really needed to mmap() the RAM on FreeBSD ? This is a Linux specific hack, and it may even be obsolete with recent Linux kernels. Regards, Fabrice. Juergen Lock wrote: > Hi! > > This is what we use on FreeBSD hosts (re kqemu), maybe it can be > committed to qemu svn: (also at > http://www.freebsd.org/cgi/cvsweb.cgi/ports/emulators/qemu/files/patch-osdep.c?rev=1.2;content-type=text%2Fplain > ) > > Index: qemu/osdep.c > @@ -79,7 +79,9 @@ > > #if defined(USE_KQEMU) > > +#ifndef __FreeBSD__ > #include > +#endif > #include > #include > > @@ -90,6 +92,7 @@ > const char *tmpdir; > char phys_ram_file[1024]; > void *ptr; > +#ifndef __FreeBSD__ > #ifdef HOST_SOLARIS > struct statvfs stfs; > #else > @@ -151,12 +154,20 @@ > } > unlink(phys_ram_file); > } > +#endif > size = (size + 4095) & ~4095; > +#ifndef __FreeBSD__ > ftruncate(phys_ram_fd, phys_ram_size + size); > ptr = mmap(NULL, > size, > PROT_WRITE | PROT_READ, MAP_SHARED, > phys_ram_fd, phys_ram_size); > +#else > + ptr = mmap(NULL, > + size, > + PROT_WRITE | PROT_READ, MAP_PRIVATE|MAP_ANON, > + -1, 0); > +#endif > if (ptr == MAP_FAILED) { > fprintf(stderr, "Could not map physical memory\n"); > exit(1); > > >