diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-09-27 15:32:41 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-09-27 15:32:41 +0000 |
commit | 06e67a82da7b0d2bb2bdada0ec7122032a330312 (patch) | |
tree | d3dc6ae44958bcd40c66707507432c35a9c56dd1 | |
parent | a876e289510fdbe260e04aa507df1efe39241804 (diff) |
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>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5331 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r-- | exec.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -443,6 +443,28 @@ static void code_gen_alloc(unsigned long tb_size) 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) { |