qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] Save 3MB ioport table memory


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH] Save 3MB ioport table memory
Date: Tue, 22 Jul 2008 20:52:27 -0500
User-agent: Thunderbird 2.0.0.14 (X11/20080501)

Samuel Thibault wrote:
Hello,

On 64bit machines, qemu uses 3MB of memory for the ioport tables, while
the actual use of them is quite sparse.  The patch below saves that
memory by leaving them zeroed and just test for that and use the default
pointer.

I really like the idea of this patch. You have some whitespace damage (tabs instead of 8 spaces) and it needs a Signed-off-by: if you'd like me to apply it.

Samuel

Index: vl.c
===================================================================
--- vl.c        (révision 4917)
+++ vl.c        (copie de travail)
@@ -279,17 +279,29 @@
 static uint32_t default_ioport_readw(void *opaque, uint32_t address)
 {
     uint32_t data;
-    data = ioport_read_table[0][address](ioport_opaque[address], address);
+    IOPortReadFunc *func = ioport_read_table[0][address];
+    if (!func)
+           func = default_ioport_readb;

Perhaps you can introduce an accessor?  Something like:

static uint32_t ioport_read_defaults(void *opaque, int index, uint32_t address)
{
static IOPortReadFunc *default_funcs[3] = {default_ioport_readb, default_ioport_readw, default_ioport_readl};
   IOPortReadFunc *func = ioport_read_table[index][address];
   if (!func)
       func = default_funcs[index];
   return func(opaque, address);
}

That would simplify the rest of the changes significantly.

Regards,

Anthony Liguori





reply via email to

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