Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 215747
b: refs/heads/master
c: 48bb5d3
h: refs/heads/master
i:
  215745: e96ba67
  215743: 9b782c4
v: v3
  • Loading branch information
Avi Kivity committed Oct 24, 2010
1 parent 2502439 commit 3a6f625
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7077aec0bcd2f827aeb84ccc56c6f4367c376436
refs/heads/master: 48bb5d3c401679e41e7a7f06ca31b3e54a6168f7
19 changes: 18 additions & 1 deletion trunk/arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2279,6 +2279,22 @@ static int em_imul_3op(struct x86_emulate_ctxt *ctxt)
return em_imul(ctxt);
}

static int em_rdtsc(struct x86_emulate_ctxt *ctxt)
{
unsigned cpl = ctxt->ops->cpl(ctxt->vcpu);
struct decode_cache *c = &ctxt->decode;
u64 tsc = 0;

if (cpl > 0 && (ctxt->ops->get_cr(4, ctxt->vcpu) & X86_CR4_TSD)) {
emulate_gp(ctxt, 0);
return X86EMUL_PROPAGATE_FAULT;
}
ctxt->ops->get_msr(ctxt->vcpu, MSR_IA32_TSC, &tsc);
c->regs[VCPU_REGS_RAX] = (u32)tsc;
c->regs[VCPU_REGS_RDX] = tsc >> 32;
return X86EMUL_CONTINUE;
}

#define D(_y) { .flags = (_y) }
#define N D(0)
#define G(_f, _g) { .flags = ((_f) | Group), .u.group = (_g) }
Expand Down Expand Up @@ -2469,7 +2485,8 @@ static struct opcode twobyte_table[256] = {
N, N, N, N,
N, N, N, N, N, N, N, N,
/* 0x30 - 0x3F */
D(ImplicitOps | Priv), N, D(ImplicitOps | Priv), N,
D(ImplicitOps | Priv), I(ImplicitOps, em_rdtsc),
D(ImplicitOps | Priv), N,
D(ImplicitOps), D(ImplicitOps | Priv), N, N,
N, N, N, N, N, N, N, N,
/* 0x40 - 0x4F */
Expand Down

0 comments on commit 3a6f625

Please sign in to comment.