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

[Xen-changelog] [xen-3.0.4-testing] [QEMU] Align VGA ram allocation



# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
# Date 1166708599 0
# Node ID 2871dd01664b5e13c0f9efd03477af40aa151a79
# Parent  d6ae86aecc372e66110653ed98836a2b4f6d21fb
[QEMU] Align VGA ram allocation
This makes the SSE-optimized vram_dirty() safe again.
Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>

Based on xen-unstable changeset 13118:dae6bc4241dbc3beb87b8530bcfc5127c6d92eb0
---
 tools/ioemu/hw/vga.c     |   11 ++++++++---
 tools/ioemu/hw/vga_int.h |    1 +
 2 files changed, 9 insertions(+), 3 deletions(-)

diff -r d6ae86aecc37 -r 2871dd01664b tools/ioemu/hw/vga.c
--- a/tools/ioemu/hw/vga.c      Thu Dec 21 11:22:39 2006 +0000
+++ b/tools/ioemu/hw/vga.c      Thu Dec 21 13:43:19 2006 +0000
@@ -2002,7 +2002,10 @@ void vga_common_init(VGAState *s, Displa
     s->vram_shadow = (uint8_t *)((long)(s->vram_shadow + TARGET_PAGE_SIZE - 1)
                                  & ~(TARGET_PAGE_SIZE - 1));
 
-    s->vram_ptr = qemu_malloc(vga_ram_size);
+    /* Video RAM must be 128-bit aligned for SSE optimizations later */
+    s->vram_alloc = qemu_malloc(vga_ram_size + 15);
+    s->vram_ptr = (uint8_t *)((long)(s->vram_alloc + 15) & ~15L);
+
     s->vram_offset = vga_ram_offset;
     s->vram_size = vga_ram_size;
     s->ds = ds;
@@ -2126,7 +2129,7 @@ void *vga_update_vram(VGAState *s, void 
     }
 
     if (!vga_ram_base) {
-        vga_ram_base = qemu_malloc(vga_ram_size);
+        vga_ram_base = qemu_malloc(vga_ram_size + TARGET_PAGE_SIZE + 1);
         if (!vga_ram_base) {
             fprintf(stderr, "reallocate error\n");
             return NULL;
@@ -2134,8 +2137,10 @@ void *vga_update_vram(VGAState *s, void 
     }
 
     /* XXX lock needed? */
+    old_pointer = s->vram_alloc;
+    s->vram_alloc = vga_ram_base;
+    vga_ram_base = (uint8_t *)((long)(vga_ram_base + 15) & ~15L);
     memcpy(vga_ram_base, s->vram_ptr, vga_ram_size);
-    old_pointer = s->vram_ptr;
     s->vram_ptr = vga_ram_base;
 
     return old_pointer;
diff -r d6ae86aecc37 -r 2871dd01664b tools/ioemu/hw/vga_int.h
--- a/tools/ioemu/hw/vga_int.h  Thu Dec 21 11:22:39 2006 +0000
+++ b/tools/ioemu/hw/vga_int.h  Thu Dec 21 13:43:19 2006 +0000
@@ -78,6 +78,7 @@
 #define VGA_MAX_HEIGHT 2048
 
 #define VGA_STATE_COMMON                                                \
+    uint8_t *vram_alloc;                                                \
     uint8_t *vram_ptr;                                                  \
     uint8_t *vram_shadow;                                               \
     unsigned long vram_offset;                                          \

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.