From 284e648036510a322d21be574302f7aec1c9a89b Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Tue, 16 Nov 2010 12:48:02 +0200 Subject: [PATCH] tpr optimization: clear the vapic area on boot If the option rom is loaded with rep/insb (as newer seabios versions do), then the writes to the vapic area may be corrupted by the kernel. Fix by explicitly clearing the vapic area on option rom startup. Signed-off-by: Avi Kivity --- pc-bios/optionrom/vapic.S | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pc-bios/optionrom/vapic.S b/pc-bios/optionrom/vapic.S index afe98a9cab..3c8dcf1c25 100644 --- a/pc-bios/optionrom/vapic.S +++ b/pc-bios/optionrom/vapic.S @@ -4,6 +4,17 @@ _start: .short 0xaa55 .byte (_end - _start) / 512 + # clear vapic area: firmware load using rep insb may cause + # stale tpr/isr/irr data to corrupt the vapic area. + push %es + push %cs + pop %es + xor %ax, %ax + mov $vapic_size/2, %cx + lea vapic, %di + cld + rep stosw + pop %es mov $vapic_base, %ax out %ax, $0x7e lret -- 2.11.4.GIT