Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KMlLN-0002tx-C2 for qemu-devel@nongnu.org; Sat, 26 Jul 2008 11:06:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KMlLM-0002td-Lx for qemu-devel@nongnu.org; Sat, 26 Jul 2008 11:06:00 -0400 Received: from [199.232.76.173] (port=48410 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KMlLM-0002tX-2F for qemu-devel@nongnu.org; Sat, 26 Jul 2008 11:06:00 -0400 Received: from savannah.gnu.org ([199.232.41.3]:58728 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KMlLL-0005CB-Dp for qemu-devel@nongnu.org; Sat, 26 Jul 2008 11:05:59 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KMlLK-0002an-Jp for qemu-devel@nongnu.org; Sat, 26 Jul 2008 15:05:58 +0000 Received: from blueswir1 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KMlLK-0002aj-Cb for qemu-devel@nongnu.org; Sat, 26 Jul 2008 15:05:58 +0000 MIME-Version: 1.0 Errors-To: blueswir1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Blue Swirl Message-Id: Date: Sat, 26 Jul 2008 15:05:58 +0000 Subject: [Qemu-devel] [4951] Map code buffers below 2G on Sparc64 Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 4951 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4951 Author: blueswir1 Date: 2008-07-26 15:05:57 +0000 (Sat, 26 Jul 2008) Log Message: ----------- Map code buffers below 2G on Sparc64 Modified Paths: -------------- trunk/exec.c trunk/sparc64.ld Modified: trunk/exec.c =================================================================== --- trunk/exec.c 2008-07-26 11:21:03 UTC (rev 4950) +++ trunk/exec.c 2008-07-26 15:05:57 UTC (rev 4951) @@ -89,9 +89,9 @@ /* any access to the tbs or the page table must use this lock */ spinlock_t tb_lock = SPIN_LOCK_UNLOCKED; -#if defined(__arm__) -/* The prologue must be reachable with a direct jump. ARM has a - limited branch range (possibly also PPC and SPARC?) so place it in a +#if defined(__arm__) || defined(__sparc_v9__) +/* The prologue must be reachable with a direct jump. ARM and Sparc64 + have limited branch ranges (possibly also PPC) so place it in a section close to code segment. */ #define code_gen_section \ __attribute__((__section__(".gen_code"))) \ @@ -410,15 +410,23 @@ #if defined(__linux__) { int flags; + void *start = NULL; + flags = MAP_PRIVATE | MAP_ANONYMOUS; #if defined(__x86_64__) flags |= MAP_32BIT; /* 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; + start = (void *) 0x60000000UL; + if (code_gen_buffer_size > (512 * 1024 * 1024)) + code_gen_buffer_size = (512 * 1024 * 1024); #endif - code_gen_buffer = mmap(NULL, code_gen_buffer_size, - PROT_WRITE | PROT_READ | PROT_EXEC, + code_gen_buffer = mmap(start, 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"); Modified: trunk/sparc64.ld =================================================================== --- trunk/sparc64.ld 2008-07-26 11:21:03 UTC (rev 4950) +++ trunk/sparc64.ld 2008-07-26 15:05:57 UTC (rev 4951) @@ -69,6 +69,7 @@ . = ALIGN(0x100000) + (. & (0x100000 - 1)); .data : { + *(.gen_code) *(.data) *(.gnu.linkonce.d*) CONSTRUCTORS