# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
# Date 1166708599 0
# Node ID dae6bc4241dbc3beb87b8530bcfc5127c6d92eb0
# Parent 5c46e27e3915734b1a98bce8fce1239e57990c8c
[QEMU] Align VGA ram allocation
This makes the SSE-optimized vram_dirty() safe again.
Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
---
tools/ioemu/hw/vga.c | 11 ++++++++---
tools/ioemu/hw/vga_int.h | 1 +
2 files changed, 9 insertions(+), 3 deletions(-)
diff -r 5c46e27e3915 -r dae6bc4241db tools/ioemu/hw/vga.c
--- a/tools/ioemu/hw/vga.c Thu Dec 21 12:08:27 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 5c46e27e3915 -r dae6bc4241db tools/ioemu/hw/vga_int.h
--- a/tools/ioemu/hw/vga_int.h Thu Dec 21 12:08:27 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
|