* [Qemu-devel] [5331] Allocate code gen buffer properly on FreeBSD
@ 2008-09-27 15:32 Anthony Liguori
0 siblings, 0 replies; only message in thread
From: Anthony Liguori @ 2008-09-27 15:32 UTC (permalink / raw)
To: qemu-devel
Revision: 5331
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5331
Author: aliguori
Date: 2008-09-27 15:32:41 +0000 (Sat, 27 Sep 2008)
Log Message:
-----------
Allocate code gen buffer properly on FreeBSD
Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Modified Paths:
--------------
trunk/exec.c
Modified: trunk/exec.c
===================================================================
--- trunk/exec.c 2008-09-26 21:03:37 UTC (rev 5330)
+++ trunk/exec.c 2008-09-27 15:32:41 UTC (rev 5331)
@@ -443,6 +443,28 @@
exit(1);
}
}
+#elif defined(__FreeBSD__)
+ {
+ int flags;
+ void *addr = NULL;
+ flags = MAP_PRIVATE | MAP_ANONYMOUS;
+#if defined(__x86_64__)
+ /* FreeBSD doesn't have MAP_32BIT, use MAP_FIXED and assume
+ * 0x40000000 is free */
+ flags |= MAP_FIXED;
+ addr = (void *)0x40000000;
+ /* Cannot map more than that */
+ if (code_gen_buffer_size > (800 * 1024 * 1024))
+ code_gen_buffer_size = (800 * 1024 * 1024);
+#endif
+ code_gen_buffer = mmap(addr, code_gen_buffer_size,
+ PROT_WRITE | PROT_READ | PROT_EXEC,
+ flags, -1, 0);
+ if (code_gen_buffer == MAP_FAILED) {
+ fprintf(stderr, "Could not allocate dynamic translator buffer\n");
+ exit(1);
+ }
+ }
#else
code_gen_buffer = qemu_malloc(code_gen_buffer_size);
if (!code_gen_buffer) {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-09-27 15:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-27 15:32 [Qemu-devel] [5331] Allocate code gen buffer properly on FreeBSD Anthony Liguori
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).