aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-06-05 09:15:51 -0400
committerAvi Kivity <avi@qumranet.com>2007-07-16 05:05:46 -0400
commit72d6e5a08a8ba2105b3f36e32285e8fbfbed1f71 (patch)
tree6d20932e350683760d79f2c6cca6ef3bfafbce96 /drivers
parentd3bef15f84f91c73a5515ad4c6a1749f8f63afcf (diff)
KVM: Emulate hlt on real mode for Intel
This has two use cases: the bios can't boot from disk, and guest smp bootstrap. Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/kvm/kvm.h1
-rw-r--r--drivers/kvm/vmx.c7
-rw-r--r--drivers/kvm/x86_emulate.c6
3 files changed, 12 insertions, 2 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index ac358b8d3de8..d49b16cae27a 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -347,6 +347,7 @@ struct kvm_vcpu {
347 u32 ar; 347 u32 ar;
348 } tr, es, ds, fs, gs; 348 } tr, es, ds, fs, gs;
349 } rmode; 349 } rmode;
350 int halt_request; /* real mode on Intel only */
350 351
351 int cpuid_nent; 352 int cpuid_nent;
352 struct kvm_cpuid_entry cpuid_entries[KVM_MAX_CPUID_ENTRIES]; 353 struct kvm_cpuid_entry cpuid_entries[KVM_MAX_CPUID_ENTRIES];
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index 90abd3c58c65..a1f51b9d482d 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -1608,8 +1608,13 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1608 1608
1609 if (vcpu->rmode.active && 1609 if (vcpu->rmode.active &&
1610 handle_rmode_exception(vcpu, intr_info & INTR_INFO_VECTOR_MASK, 1610 handle_rmode_exception(vcpu, intr_info & INTR_INFO_VECTOR_MASK,
1611 error_code)) 1611 error_code)) {
1612 if (vcpu->halt_request) {
1613 vcpu->halt_request = 0;
1614 return kvm_emulate_halt(vcpu);
1615 }
1612 return 1; 1616 return 1;
1617 }
1613 1618
1614 if ((intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VECTOR_MASK)) == (INTR_TYPE_EXCEPTION | 1)) { 1619 if ((intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VECTOR_MASK)) == (INTR_TYPE_EXCEPTION | 1)) {
1615 kvm_run->exit_reason = KVM_EXIT_DEBUG; 1620 kvm_run->exit_reason = KVM_EXIT_DEBUG;
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index 6123c0292b22..a4a84817b274 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -143,7 +143,8 @@ static u8 opcode_table[256] = {
143 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
144 /* 0xF0 - 0xF7 */ 144 /* 0xF0 - 0xF7 */
145 0, 0, 0, 0, 145 0, 0, 0, 0,
146 0, 0, ByteOp | DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM, 146 ImplicitOps, 0,
147 ByteOp | DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM,
147 /* 0xF8 - 0xFF */ 148 /* 0xF8 - 0xFF */
148 0, 0, 0, 0, 149 0, 0, 0, 0,
149 0, 0, ByteOp | DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM 150 0, 0, ByteOp | DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM
@@ -1149,6 +1150,9 @@ special_insn:
1149 case 0xae ... 0xaf: /* scas */ 1150 case 0xae ... 0xaf: /* scas */
1150 DPRINTF("Urk! I don't handle SCAS.\n"); 1151 DPRINTF("Urk! I don't handle SCAS.\n");
1151 goto cannot_emulate; 1152 goto cannot_emulate;
1153 case 0xf4: /* hlt */
1154 ctxt->vcpu->halt_request = 1;
1155 goto done;
1152 } 1156 }
1153 goto writeback; 1157 goto writeback;
1154 1158