qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [patch] 64 bit truncation in code_gen_buffer_size calculati


From: Jes Sorensen
Subject: [Qemu-devel] [patch] 64 bit truncation in code_gen_buffer_size calculation
Date: Wed, 24 Sep 2008 11:05:16 +0200
User-agent: Thunderbird 2.0.0.16 (X11/20080723)

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



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 <address@hidden>

---
 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)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]