qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [patch] 64 bit truncation in code_gen_buffer_size calculation
@ 2008-09-24  9:05 Jes Sorensen
  2008-09-24 14:09 ` [Qemu-devel] " Anthony Liguori
  0 siblings, 1 reply; 2+ messages in thread
From: Jes Sorensen @ 2008-09-24  9:05 UTC (permalink / raw)
  To: qemu-devel, Anthony Liguori

[-- Attachment #1: Type: text/plain, Size: 246 bytes --]

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




[-- Attachment #2: 1199-code-gen-64bit.patch --]
[-- Type: text/plain, Size: 741 bytes --]

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 <jes@sgi.com>

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-24 14:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-24  9:05 [Qemu-devel] [patch] 64 bit truncation in code_gen_buffer_size calculation Jes Sorensen
2008-09-24 14:09 ` [Qemu-devel] " Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).