tpr optimization: clear the vapic area on boot
PATCH 1/1 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 <[email protected]>
--- pc-bios/bios.bin | Bin 131072 -> 131072 bytes pc-bios/optionrom/vapic.S | 11 +++++++++++ 2 files changed, 11 insertions(+), 0 deletions(-)
pc-bios/bios.bin binary +0 -0
pc-bios/optionrom/vapic.S +11 -0
@@ -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
Signature · 1 line
1.7.3.1
Quoted 8 lines · Avi Kivity
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<[email protected]>--- pc-bios/bios.bin | Bin 131072 -> 131072 bytes
This bit was unintended.
Quoted 12 lines
pc-bios/optionrom/vapic.S +4
-0@@ -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
pc-bios/optionrom/vapic.S line 20
Quoted 10 lines
pc-bios/optionrom/vapic.S +7
-0+ 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
This is the interesting part.
Signature · 1 line
error compiling committee.c: too many arguments to function