summaryrefslogtreecommitdiff
path: root/bios
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2008-09-07 19:34:47 +0300
committerAvi Kivity <avi@qumranet.com>2008-09-07 19:34:47 +0300
commitb00d0057498bb9c43247e0c23dde438c2894fac0 (patch)
tree4b1c9965b166830eef1215ebaef016e6a8e7ad41 /bios
parent0ebcfd8101fdfad3b3875b134bab3587025de8a1 (diff)
kvm: bios: use windows pcr to get cpu number rather than tr
using tr to hold the current cpu number interferes with hibernate/resume in smp. so instead, get the cpu number directly from the windows pcr at fs:0x51. use byte 4 of the per-cpu vapic region to check whether vapic is enabled. Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'bios')
-rw-r--r--bios/vapic.S17
1 files changed, 8 insertions, 9 deletions
diff --git a/bios/vapic.S b/bios/vapic.S
index 0c7ca844..cf2a474d 100644
--- a/bios/vapic.S
+++ b/bios/vapic.S
@@ -58,7 +58,7 @@ real_tpr:
kvm_hypercall_vapic_poll_irq = 1
-tr_vcpu_signature = 0xdb
+pcr_cpu = 0x51
.align 64
@@ -68,13 +68,12 @@ mp_get_tpr_eax:
reenable_vtpr
push %ecx
- str %eax
- cmp $tr_vcpu_signature, %al
- jne mp_get_tpr_bad
- movzbl %ah, %eax
+ fs/movzbl pcr_cpu, %eax
mov vcpu_shift, %ecx ; fixup
shl %cl, %eax
+ testb $1, vapic+4(%eax) ; fixup delta=-5
+ jz mp_get_tpr_bad
movzbl vapic(%eax), %eax ; fixup
mp_get_tpr_out:
@@ -143,14 +142,14 @@ mp_set_tpr:
reenable_vtpr
mp_set_tpr_failed:
- str %eax
- cmp $tr_vcpu_signature, %al
- jne mp_set_tpr_bad
- movzbl %ah, %edx
+ fs/movzbl pcr_cpu, %edx
mov vcpu_shift, %ecx ; fixup
shl %cl, %edx
+ testb $1, vapic+4(%edx) ; fixup delta=-5
+ jz mp_set_tpr_bad
+
mov vapic(%edx), %eax ; fixup
mov %eax, %ebx