aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware/vgabios
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-06-07 14:13:22 +0100
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-06-07 14:13:22 +0100
commit104f354554e81d3185a5f7959a89e3698e917545 (patch)
tree123f70e642c25794a080b91c0fc40814ace08a99 /tools/firmware/vgabios
parent2928514138945c3ed7e5d34ca726d2904476852c (diff)
downloadxen-104f354554e81d3185a5f7959a89e3698e917545.tar.gz
xen-104f354554e81d3185a5f7959a89e3698e917545.tar.bz2
xen-104f354554e81d3185a5f7959a89e3698e917545.zip
[HVM][DM] Cleaner way of clearing VGA memory on mode changes (thanks to
Fabrice Bellard on the QEMU project). 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@intel.com>
Diffstat (limited to 'tools/firmware/vgabios')
-rw-r--r--tools/firmware/vgabios/clext.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/tools/firmware/vgabios/clext.c b/tools/firmware/vgabios/clext.c
index 31a50a2326..1eb3c69734 100644
--- a/tools/firmware/vgabios/clext.c
+++ b/tools/firmware/vgabios/clext.c
@@ -525,6 +525,13 @@ cirrus_debug_dump:
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