qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Leonardo Reiter" <lreiter76@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] FreeBSD Support
Date: Sat, 24 Feb 2007 15:54:35 -0500	[thread overview]
Message-ID: <779506c70702241254p306368f8k6bfbc189c7ed488e@mail.gmail.com> (raw)
In-Reply-To: <200702241908.l1OJ8e7a008745@saturn.kn-bremen.de>

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 <nox@jelal.kn-bremen.de> 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 <sys/vfs.h>
> +#endif
>  #include <sys/mman.h>
>  #include <fcntl.h>
>
> @@ -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
>

  reply	other threads:[~2007-02-24 20:54 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-16 19:02 [Qemu-devel] QEMU: VNC Christopher Olsen
2007-02-16 20:57 ` Anthony Liguori
2007-02-18 20:36 ` Christopher Olsen
2007-02-18 23:08   ` Anthony Liguori
2007-02-18 23:53     ` Christopher Olsen
2007-02-19  0:14       ` Johannes Schindelin
2007-02-19  0:30         ` Christopher Olsen
2007-02-19  0:41           ` Johannes Schindelin
2007-02-19  2:01           ` Anthony Liguori
2007-02-19  2:11             ` Johannes Schindelin
2007-02-19  2:48               ` Anthony Liguori
2007-02-19 12:19                 ` Christopher Olsen
2007-02-19 14:53                   ` Johannes Schindelin
2007-02-19 17:16                     ` Christopher Olsen
2007-02-19 17:30               ` Daniel P. Berrange
2007-02-19 17:41                 ` Christopher Olsen
2007-02-19 19:09                   ` Daniel P. Berrange
2007-02-19 19:29                     ` Christopher Olsen
2007-02-19 22:52                     ` Fabrice Bellard
2007-02-19 23:37                       ` Christopher Olsen
2007-02-20  0:36                         ` Daniel P. Berrange
2007-02-20  0:45                           ` Anthony Liguori
2007-02-20  0:53                             ` Christopher Olsen
2007-02-20  1:05                             ` Daniel P. Berrange
2007-02-20  1:11                               ` Johannes Schindelin
2007-02-20  1:18                                 ` Christopher Olsen
2007-02-20 19:46                                 ` Joe Batt
2007-02-20  1:15                               ` [Qemu-devel] FreeBSD Support Christopher Olsen
2007-02-20  1:46                                 ` Paul Brook
2007-02-20  2:10                                   ` Christopher Olsen
2007-02-20  2:41                                     ` Paul Brook
2007-02-20  3:26                                       ` Christopher Olsen
2007-02-24 19:08                                         ` Juergen Lock
2007-02-24 20:54                                           ` Leonardo Reiter [this message]
2007-02-26  0:12                                         ` andrzej zaborowski
2007-03-03 22:12                                           ` Thiemo Seufer
2007-03-05  7:38                                             ` andrzej zaborowski
2007-02-19 23:58                       ` [Qemu-devel] QEMU: VNC Johannes Schindelin
2007-02-19  0:11   ` Johannes Schindelin
2007-02-19  0:25     ` Christopher Olsen
  -- strict thread matches above, loose matches on Subject: below --
2007-02-20  2:08 [Qemu-devel] FreeBSD Support Ben Taylor
2007-02-20  2:15 ` Christopher Olsen
2007-02-20  5:14 ` M. Warner Losh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=779506c70702241254p306368f8k6bfbc189c7ed488e@mail.gmail.com \
    --to=lreiter76@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).