From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KiQJM-00006N-N3 for qemu-devel@nongnu.org; Wed, 24 Sep 2008 05:05:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KiQJK-00005L-9C for qemu-devel@nongnu.org; Wed, 24 Sep 2008 05:05:28 -0400 Received: from [199.232.76.173] (port=58627 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KiQJJ-00005B-Uz for qemu-devel@nongnu.org; Wed, 24 Sep 2008 05:05:25 -0400 Received: from relay2.sgi.com ([192.48.171.30]:52535 helo=relay.sgi.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KiQJJ-0005LB-7L for qemu-devel@nongnu.org; Wed, 24 Sep 2008 05:05:25 -0400 Message-ID: <48DA02CC.9060802@sgi.com> Date: Wed, 24 Sep 2008 11:05:16 +0200 From: Jes Sorensen MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020102080308020702090103" Subject: [Qemu-devel] [patch] 64 bit truncation in code_gen_buffer_size calculation 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, Anthony Liguori This is a multi-part message in MIME format. --------------020102080308020702090103 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, This one is pretty obvious, don't truncate the result of code_gen_buffer_size calculation to int when the target is an unsigned long. Gives funny results when trying to boot something with a lot of memory on a 64 bit system. Cheers, Jes --------------020102080308020702090103 Content-Type: text/plain; name="1199-code-gen-64bit.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="1199-code-gen-64bit.patch" Don't truncate code_gen_buffer_size calculation to int, as it will give unpredicted results on 64 bit systems when booting large guests. Signed-off-by: Jes Sorensen --- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: qemu/exec.c =================================================================== --- qemu.orig/exec.c +++ qemu/exec.c @@ -410,7 +410,7 @@ static void code_gen_alloc(unsigned long code_gen_buffer_size = DEFAULT_CODE_GEN_BUFFER_SIZE; #else /* XXX: needs ajustments */ - code_gen_buffer_size = (int)(phys_ram_size / 4); + code_gen_buffer_size = (unsigned long)(phys_ram_size / 4); #endif } if (code_gen_buffer_size < MIN_CODE_GEN_BUFFER_SIZE) --------------020102080308020702090103--