diff options
author | Izik Eidus <izike@qumranet.com> | 2008-03-24 17:14:53 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-04-27 05:00:39 -0400 |
commit | 37817f2982d0f559f90cecc66e150dd9d2c2df05 (patch) | |
tree | 45114b5720d7a13bdbe48cc6a75dc6de03d6fcd2 /arch/x86/kvm/vmx.c | |
parent | 2e4d2653497856b102c90153f970c9e344ba96c6 (diff) |
KVM: x86: hardware task switching support
This emulates the x86 hardware task switch mechanism in software, as it is
unsupported by either vmx or svm. It allows operating systems which use it,
like freedos, to run as kvm guests.
Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 9b560325b127..cbca46acfac3 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -2249,6 +2249,20 @@ static int handle_apic_access(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
2249 | return 1; | 2249 | return 1; |
2250 | } | 2250 | } |
2251 | 2251 | ||
2252 | static int handle_task_switch(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | ||
2253 | { | ||
2254 | unsigned long exit_qualification; | ||
2255 | u16 tss_selector; | ||
2256 | int reason; | ||
2257 | |||
2258 | exit_qualification = vmcs_readl(EXIT_QUALIFICATION); | ||
2259 | |||
2260 | reason = (u32)exit_qualification >> 30; | ||
2261 | tss_selector = exit_qualification; | ||
2262 | |||
2263 | return kvm_task_switch(vcpu, tss_selector, reason); | ||
2264 | } | ||
2265 | |||
2252 | /* | 2266 | /* |
2253 | * The exit handlers return 1 if the exit was handled fully and guest execution | 2267 | * The exit handlers return 1 if the exit was handled fully and guest execution |
2254 | * may resume. Otherwise they set the kvm_run parameter to indicate what needs | 2268 | * may resume. Otherwise they set the kvm_run parameter to indicate what needs |
@@ -2271,6 +2285,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu, | |||
2271 | [EXIT_REASON_TPR_BELOW_THRESHOLD] = handle_tpr_below_threshold, | 2285 | [EXIT_REASON_TPR_BELOW_THRESHOLD] = handle_tpr_below_threshold, |
2272 | [EXIT_REASON_APIC_ACCESS] = handle_apic_access, | 2286 | [EXIT_REASON_APIC_ACCESS] = handle_apic_access, |
2273 | [EXIT_REASON_WBINVD] = handle_wbinvd, | 2287 | [EXIT_REASON_WBINVD] = handle_wbinvd, |
2288 | [EXIT_REASON_TASK_SWITCH] = handle_task_switch, | ||
2274 | }; | 2289 | }; |
2275 | 2290 | ||
2276 | static const int kvm_vmx_max_exit_handlers = | 2291 | static const int kvm_vmx_max_exit_handlers = |