From patchwork Fri Jun 4 19:14:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 54676 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 02F15B7D24 for ; Sat, 5 Jun 2010 05:27:32 +1000 (EST) Received: from localhost ([127.0.0.1]:54428 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OKcY4-0003rd-Rs for incoming@patchwork.ozlabs.org; Fri, 04 Jun 2010 15:27:20 -0400 Received: from [140.186.70.92] (port=37500 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OKcMc-0004gC-JO for qemu-devel@nongnu.org; Fri, 04 Jun 2010 15:15:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OKcMa-0002Cx-Ij for qemu-devel@nongnu.org; Fri, 04 Jun 2010 15:15:30 -0400 Received: from are.twiddle.net ([75.149.56.221]:54755) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OKcMZ-0002Cc-Sz for qemu-devel@nongnu.org; Fri, 04 Jun 2010 15:15:28 -0400 Received: from anchor.twiddle.home (anchor.twiddle.home [172.31.0.4]) by are.twiddle.net (Postfix) with ESMTPS id 1E7DA105F; Fri, 4 Jun 2010 12:15:24 -0700 (PDT) Received: from anchor.twiddle.home (anchor.twiddle.home [127.0.0.1]) by anchor.twiddle.home (8.14.4/8.14.4) with ESMTP id o54JFLGj007185; Fri, 4 Jun 2010 12:15:21 -0700 Received: (from rth@localhost) by anchor.twiddle.home (8.14.4/8.14.4/Submit) id o54JFJgP007184; Fri, 4 Jun 2010 12:15:19 -0700 From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 4 Jun 2010 12:14:14 -0700 Message-Id: <1275678883-7082-7-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.0.1 In-Reply-To: <1275678883-7082-1-git-send-email-rth@twiddle.net> References: <1275678883-7082-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: agraf@suse.de, aurelien@aurel32.net Subject: [Qemu-devel] [PATCH 06/35] tcg-s390: Allocate the code_gen_buffer near the main program. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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,