From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HL3um-0002TV-Cw for qemu-devel@nongnu.org; Sat, 24 Feb 2007 15:54:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HL3uk-0002Sq-K3 for qemu-devel@nongnu.org; Sat, 24 Feb 2007 15:54:43 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HL3uk-0002Sb-9h for qemu-devel@nongnu.org; Sat, 24 Feb 2007 15:54:42 -0500 Received: from nz-out-0506.google.com ([64.233.162.228]) by monty-python.gnu.org with esmtp (Exim 4.52) id 1HL3uj-0000bo-FD for qemu-devel@nongnu.org; Sat, 24 Feb 2007 15:54:41 -0500 Received: by nz-out-0506.google.com with SMTP id i11so1485378nzi for ; Sat, 24 Feb 2007 12:54:39 -0800 (PST) Message-ID: <779506c70702241254p306368f8k6bfbc189c7ed488e@mail.gmail.com> Date: Sat, 24 Feb 2007 15:54:35 -0500 From: "Leonardo Reiter" Subject: Re: [Qemu-devel] FreeBSD Support In-Reply-To: <200702241908.l1OJ8e7a008745@saturn.kn-bremen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200702161402.23660.cwolsen@domainatlantic.com> <200702192110.52907.cwolsen@domainatlantic.com> <200702200241.26220.paul@codesourcery.com> <200702192226.45410.cwolsen@domainatlantic.com> <200702241908.l1OJ8e7a008745@saturn.kn-bremen.de> 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 MAP_PRIVATE|MAP_ANON also works on Solaris. In fact, Linux is the only platform where it doesn't work due to a bug in the Linux kernel as Fabrice mentions: http://www.qemu.org/kqemu-tech.html#SEC7 Technically on Solaris, /tmp is probably the same thing as MAP_PRIVATE|MAP_ANON since the filesystem is actually mapped to virtual memory... however, it's much cleaner to not use a file if not necessary. I can post a reworked patch that makes the file mapping for the Linux case only if anyone's interested, but it's a pretty simple change. - Leo Reiter On 2/24/07, Juergen Lock wrote: > In article <200702192226.45410.cwolsen@domainatlantic.com> you write: > >-=-=-=-=-=- > > > >Ok FreeBSD Support round one.. > > > >Be gentle this is my first attempt at working with the rest of this > >community.. > > > >Files it modifies and the reasons are as follows > > > >configure - Adds HOST_FREEBSD type to alter included libraries FreeBSD does > >not need -ltr > >Makefile.target - Once again uses HOST_FREEBSD to avoid including -ltr > > > >osdeps.c - FreeBSD does not have /dev/shm so it uses /tmp for kqemu_valloc > >also sys/vfs.h is not part of freebsd stat information is part of > >mount.h/param.h > >... > > Actually the port simply uses mmap MAP_PRIVATE|MAP_ANON, so no > tempfile is used at all (this is files/patch-osdep.c in the port): > > 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); > > > _______________________________________________ > Qemu-devel mailing list > Qemu-devel@nongnu.org > http://lists.nongnu.org/mailman/listinfo/qemu-devel >