Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 247999
b: refs/heads/master
c: 5037f6f
h: refs/heads/master
i:
  247997: e630e03
  247995: 35f7da3
  247991: bb8d967
  247983: 6e679cb
  247967: 64d4f17
  247935: e271e2d
v: v3
  • Loading branch information
Avi Kivity committed May 11, 2011
1 parent f94ed2c commit f73106a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1d6b114f20d06ac0749686e4d7b7c7913d9116db
refs/heads/master: 5037f6f324cdcc6c9071dc774aba992f96c7e5ff
2 changes: 2 additions & 0 deletions trunk/arch/x86/include/asm/kvm_emulate.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ struct x86_emulate_ops {
int (*set_dr)(int dr, unsigned long value, struct kvm_vcpu *vcpu);
int (*set_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 data);
int (*get_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata);
void (*get_fpu)(struct x86_emulate_ctxt *ctxt); /* disables preempt */
void (*put_fpu)(struct x86_emulate_ctxt *ctxt); /* reenables preempt */
};

/* Type, address-of, and value of an instruction's operand. */
Expand Down
18 changes: 18 additions & 0 deletions trunk/arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -4281,6 +4281,22 @@ static void emulator_set_segment_selector(u16 sel, int seg,
kvm_set_segment(vcpu, &kvm_seg, seg);
}

static void emulator_get_fpu(struct x86_emulate_ctxt *ctxt)
{
preempt_disable();
kvm_load_guest_fpu(ctxt->vcpu);
/*
* CR0.TS may reference the host fpu state, not the guest fpu state,
* so it may be clear at this point.
*/
clts();
}

static void emulator_put_fpu(struct x86_emulate_ctxt *ctxt)
{
preempt_enable();
}

static struct x86_emulate_ops emulate_ops = {
.read_std = kvm_read_guest_virt_system,
.write_std = kvm_write_guest_virt_system,
Expand All @@ -4304,6 +4320,8 @@ static struct x86_emulate_ops emulate_ops = {
.set_dr = emulator_set_dr,
.set_msr = kvm_set_msr,
.get_msr = kvm_get_msr,
.get_fpu = emulator_get_fpu,
.put_fpu = emulator_put_fpu,
};

static void cache_all_regs(struct kvm_vcpu *vcpu)
Expand Down

0 comments on commit f73106a

Please sign in to comment.