Thanks to Fabrice Bellard on the QEMU project who came up with a cleaner
way of clearing the VGA memory on mode changes. This patch clears the
memory in the BIOS call rather than when the Cirrus Logic register changes,
which more closely matches what happens on the real hardware.
Signed-off-by: Don Dugger <donald.d.dugger@xxxxxxxxx>
--
Don Dugger
"Censeo Toto nos in Kansa esse decisse." - D. Gale
Donald.D.Dugger@xxxxxxxxx
Ph: (303)440-1368
diff -r 0ec4b9dfd5b4 tools/firmware/vgabios/clext.c
--- a/tools/firmware/vgabios/clext.c Wed May 31 15:48:29 2006 +0100
+++ b/tools/firmware/vgabios/clext.c Tue Jun 06 14:31:16 2006 -0600
@@ -525,6 +525,13 @@ cirrus_set_video_mode_extended:
cirrus_set_video_mode_extended:
call cirrus_switch_mode
pop ax ;; mode
+ test al, #0x80
+ jnz cirrus_set_video_mode_extended_1
+ push ax
+ mov ax, #0xffff ; set to 0xff to keep win 2K happy
+ call cirrus_clear_vram
+ pop ax
+cirrus_set_video_mode_extended_1:
and al, #0x7f
push ds
@@ -992,6 +999,13 @@ cirrus_vesa_02h_1:
jnz cirrus_vesa_02h_3
call cirrus_enable_16k_granularity
cirrus_vesa_02h_3:
+ test bx, #0x8000 ;; no clear
+ jnz cirrus_vesa_02h_4
+ push ax
+ xor ax,ax
+ call cirrus_clear_vram
+ pop ax
+cirrus_vesa_02h_4:
pop ax
push ds
#ifdef CIRRUS_VESA3_PMINFO
@@ -1460,6 +1474,38 @@ cirrus_get_start_addr:
pop bx
ret
+cirrus_clear_vram:
+ pusha
+ push es
+ mov si, ax
+
+ call cirrus_enable_16k_granularity
+ call cirrus_extbios_85h
+ shl al, #2
+ mov bl, al
+ xor ah,ah
+cirrus_clear_vram_1:
+ mov al, #0x09
+ mov dx, #0x3ce
+ out dx, ax
+ push ax
+ mov cx, #0xa000
+ mov es, cx
+ xor di, di
+ mov ax, si
+ mov cx, #8192
+ cld
+ rep
+ stosw
+ pop ax
+ inc ah
+ cmp ah, bl
+ jne cirrus_clear_vram_1
+
+ pop es
+ popa
+ ret
+
cirrus_extbios_handlers:
;; 80h
dw cirrus_extbios_80h
diff -r 0ec4b9dfd5b4 tools/ioemu/hw/cirrus_vga.c
--- a/tools/ioemu/hw/cirrus_vga.c Wed May 31 15:48:29 2006 +0100
+++ b/tools/ioemu/hw/cirrus_vga.c Tue Jun 06 14:31:16 2006 -0600
@@ -1191,17 +1191,6 @@ cirrus_hook_write_sr(CirrusVGAState * s,
s->hw_cursor_y = (reg_value << 3) | (reg_index >> 5);
break;
case 0x07: // Extended Sequencer Mode
- /* Win2K seems to assume that the VRAM is set to 0xff
- * whenever VGA/SVGA mode changes
- */
- if ((s->sr[0x07] ^ reg_value) & CIRRUS_SR7_BPP_SVGA)
- memset(s->vram_ptr, 0xff, s->real_vram_size);
- s->sr[0x07] = reg_value;
-#ifdef DEBUG_CIRRUS
- printf("cirrus: handled outport sr_index %02x, sr_value %02x\n",
- reg_index, reg_value);
-#endif
- break;
case 0x08: // EEPROM Control
case 0x09: // Scratch Register 0
case 0x0a: // Scratch Register 1
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|