From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: Re: [PATCH 2/2] ioemu: initialize vram area to 0xff Date: Fri, 16 Jan 2009 16:18:11 +0000 Message-ID: <4970B343.2040707@eu.citrix.com> References: <20090115122455.GY1565%yamahata@valinux.co.jp> <496F30C4.1010702@eu.citrix.com> <20090116052211.GB1565%yamahata@valinux.co.jp> <4970AF36.8060206@eu.citrix.com> <18800.45351.340857.93487@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <18800.45351.340857.93487@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson Cc: xen-ia64-devel@lists.xensource.com, Isaku Yamahata , xen-devel@lists.xensource.com, samuel.thibault@ens-lyon.org List-Id: xen-devel@lists.xenproject.org Ian Jackson wrote: > Stefano Stabellini writes ("Re: [PATCH 2/2] ioemu: initialize vram area to 0xff"): >> [stuff] > > We seem to be reaching agreement here ? I'm afraid I've slightly lost > track of exactly which hunks of Isaku's patch are now to be > applied ... > > Ian. > Something like this: diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c index f2ec05b..e1a416b 100644 --- a/hw/cirrus_vga.c +++ b/hw/cirrus_vga.c @@ -3167,8 +3167,9 @@ static int cirrus_vga_load(QEMUFile *f, void *opaque, int version_id) * ourselves */ s->vram_gmfn = vga_acc ? s->lfb_addr : VRAM_RESERVED_ADDRESS; xen_vga_populate_vram(s->vram_gmfn, s->vram_size); + } else { + xen_vga_vram_map(s->vram_gmfn, s->vram_size); } - xen_vga_vram_map(s->vram_gmfn, s->vram_size); if (version_id < 3 || (!vga_acc && !t)) qemu_get_buffer(f, s->vram_ptr, s->vram_size); diff --git a/hw/vga.c b/hw/vga.c index 2ae6e85..d1d61ea 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -2251,7 +2251,6 @@ static int vga_load(QEMUFile *f, void *opaque, int version_id) /* Old guest, VRAM is not mapped, we have to restore it ourselves */ if (!s->vram_gmfn) { xen_vga_populate_vram(VRAM_RESERVED_ADDRESS, s->vram_size); - xen_vga_vram_map(VRAM_RESERVED_ADDRESS, s->vram_size); s->vram_gmfn = VRAM_RESERVED_ADDRESS; qemu_get_buffer(f, s->vram_ptr, s->vram_size); } @@ -2447,6 +2446,12 @@ void xen_vga_populate_vram(uint64_t vram_addr, uint32_t vga_ram_size) exit(1); } free(pfn_list); + + xen_vga_vram_map(vram_addr, vga_ram_size); + + /* Win2K seems to assume that the pattern buffer is at 0xff + initially ! */ + memset(xen_vga_state->vram_ptr, 0xff, vga_ram_size); } /* Mapping the video memory from GPFN space */ @@ -2456,7 +2461,6 @@ void xen_vga_vram_map(uint64_t vram_addr, uint32_t vga_ram_size) xen_pfn_t *pfn_list; int i; void *vram; - DisplayState *ds; fprintf(logfile, "mapping video RAM from %llx\n", (unsigned long long)vram_addr); @@ -2526,7 +2530,6 @@ void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base, if (!restore) { xen_vga_populate_vram(VRAM_RESERVED_ADDRESS, s->vram_size); - xen_vga_vram_map(VRAM_RESERVED_ADDRESS, s->vram_size); s->vram_gmfn = VRAM_RESERVED_ADDRESS; }