From patchwork Fri Jun 4 19:14:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [06/35] tcg-s390: Allocate the code_gen_buffer near the main program. From: Richard Henderson X-Patchwork-Id: 54676 Message-Id: <1275678883-7082-7-git-send-email-rth@twiddle.net> To: qemu-devel@nongnu.org Cc: agraf@suse.de, aurelien@aurel32.net Date: Fri, 4 Jun 2010 12:14:14 -0700 This allows the use of direct calls to the helpers, and a direct branch back to the epilogue. Signed-off-by: Richard Henderson --- exec.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/exec.c b/exec.c index bb3dcad..7bbfe60 100644 --- a/exec.c +++ b/exec.c @@ -519,6 +519,13 @@ static void code_gen_alloc(unsigned long tb_size) start = (void *) 0x01000000UL; if (code_gen_buffer_size > 16 * 1024 * 1024) code_gen_buffer_size = 16 * 1024 * 1024; +#elif defined(__s390x__) + /* Map the buffer so that we can use direct calls and branches. */ + /* We have a +- 4GB range on the branches; leave some slop. */ + if (code_gen_buffer_size > (3ul * 1024 * 1024 * 1024)) { + code_gen_buffer_size = 3ul * 1024 * 1024 * 1024; + } + start = (void *)0x90000000UL; #endif code_gen_buffer = mmap(start, code_gen_buffer_size, PROT_WRITE | PROT_READ | PROT_EXEC,