From: Fabrice Bellard <fabrice@bellard.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] osdep.c patch (FreeBSD hosts)
Date: Thu, 29 May 2008 23:54:31 +0200 [thread overview]
Message-ID: <483F2617.7020900@bellard.org> (raw)
In-Reply-To: <20080529214007.GA26341@saturn.kn-bremen.de>
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 <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);
>
>
>
next prev parent reply other threads:[~2008-05-29 21:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-29 21:40 [Qemu-devel] osdep.c patch (FreeBSD hosts) Juergen Lock
2008-05-29 21:54 ` Fabrice Bellard [this message]
2008-05-29 22:57 ` Juergen Lock
2008-05-29 23:03 ` Juergen Lock
2008-06-01 13:15 ` Juergen Lock
2008-06-06 19:39 ` Ed Maste
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=483F2617.7020900@bellard.org \
--to=fabrice@bellard.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.