aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2011-01-16 08:32:27 +0000
committerBlue Swirl <blauwirbel@gmail.com>2011-01-16 08:32:27 +0000
commit4cd31ad264b11274f199bbd8e96474d8cde60c42 (patch)
tree01063e6e2f58e6948efe4675b9171400a33a6d15 /exec.c
parent0c16e71e6a96a91e65c2a2e7b14b86423a21dd94 (diff)
downloadqemu-4cd31ad264b11274f199bbd8e96474d8cde60c42.zip
qemu-4cd31ad264b11274f199bbd8e96474d8cde60c42.tar.gz
qemu-4cd31ad264b11274f199bbd8e96474d8cde60c42.tar.bz2
tcg/sparc64: fix segfault
With current OpenBSD, code_gen_buffer was mapped 8GB away from text segment. Then any helpers were beyond the 2GB range of call instruction genereated by TCG and so the calls would go nowhere, leading to a segfault. Fix by specifying an address for the code_gen_buffer, hopefully free and nearby the helpers. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/exec.c b/exec.c
index 49c28b1..e950df2 100644
--- a/exec.c
+++ b/exec.c
@@ -531,6 +531,13 @@ static void code_gen_alloc(unsigned long tb_size)
/* Cannot map more than that */
if (code_gen_buffer_size > (800 * 1024 * 1024))
code_gen_buffer_size = (800 * 1024 * 1024);
+#elif defined(__sparc_v9__)
+ // Map the buffer below 2G, so we can use direct calls and branches
+ flags |= MAP_FIXED;
+ addr = (void *) 0x60000000UL;
+ if (code_gen_buffer_size > (512 * 1024 * 1024)) {
+ code_gen_buffer_size = (512 * 1024 * 1024);
+ }
#endif
code_gen_buffer = mmap(addr, code_gen_buffer_size,
PROT_WRITE | PROT_READ | PROT_EXEC,