Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 215646
b: refs/heads/master
c: 9aabc88
h: refs/heads/master
v: v3
  • Loading branch information
Avi Kivity committed Oct 24, 2010
1 parent 482b326 commit 98cd6c1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 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: ab85b12b1a7fd125588f9447653a71ec8e1b5024
refs/heads/master: 9aabc88fc8687ba3a520e2ec459821d05f72474e
9 changes: 4 additions & 5 deletions trunk/arch/x86/include/asm/kvm_emulate.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ struct decode_cache {
};

struct x86_emulate_ctxt {
struct x86_emulate_ops *ops;

/* Register state before/after emulation. */
struct kvm_vcpu *vcpu;

Expand Down Expand Up @@ -249,12 +251,9 @@ struct x86_emulate_ctxt {
#define X86EMUL_MODE_HOST X86EMUL_MODE_PROT64
#endif

int x86_decode_insn(struct x86_emulate_ctxt *ctxt,
struct x86_emulate_ops *ops);
int x86_emulate_insn(struct x86_emulate_ctxt *ctxt,
struct x86_emulate_ops *ops);
int x86_decode_insn(struct x86_emulate_ctxt *ctxt);
int x86_emulate_insn(struct x86_emulate_ctxt *ctxt);
int emulator_task_switch(struct x86_emulate_ctxt *ctxt,
struct x86_emulate_ops *ops,
u16 tss_selector, int reason,
bool has_error_code, u32 error_code);

Expand Down
8 changes: 5 additions & 3 deletions trunk/arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -943,8 +943,9 @@ static int decode_abs(struct x86_emulate_ctxt *ctxt,
}

int
x86_decode_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
x86_decode_insn(struct x86_emulate_ctxt *ctxt)
{
struct x86_emulate_ops *ops = ctxt->ops;
struct decode_cache *c = &ctxt->decode;
int rc = X86EMUL_CONTINUE;
int mode = ctxt->mode;
Expand Down Expand Up @@ -2586,10 +2587,10 @@ static int emulator_do_task_switch(struct x86_emulate_ctxt *ctxt,
}

int emulator_task_switch(struct x86_emulate_ctxt *ctxt,
struct x86_emulate_ops *ops,
u16 tss_selector, int reason,
bool has_error_code, u32 error_code)
{
struct x86_emulate_ops *ops = ctxt->ops;
struct decode_cache *c = &ctxt->decode;
int rc;

Expand Down Expand Up @@ -2619,8 +2620,9 @@ static void string_addr_inc(struct x86_emulate_ctxt *ctxt, unsigned long base,
}

int
x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
{
struct x86_emulate_ops *ops = ctxt->ops;
u64 msr_data;
struct decode_cache *c = &ctxt->decode;
int rc = X86EMUL_CONTINUE;
Expand Down
7 changes: 4 additions & 3 deletions trunk/arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -3998,7 +3998,7 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
vcpu->arch.emulate_ctxt.interruptibility = 0;
vcpu->arch.emulate_ctxt.exception = -1;

r = x86_decode_insn(&vcpu->arch.emulate_ctxt, &emulate_ops);
r = x86_decode_insn(&vcpu->arch.emulate_ctxt);
trace_kvm_emulate_insn_start(vcpu);

/* Only allow emulation of specific instructions on #UD
Expand Down Expand Up @@ -4048,7 +4048,7 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
memcpy(c->regs, vcpu->arch.regs, sizeof c->regs);

restart:
r = x86_emulate_insn(&vcpu->arch.emulate_ctxt, &emulate_ops);
r = x86_emulate_insn(&vcpu->arch.emulate_ctxt);

if (r) { /* emulation failed */
if (reexecute_instruction(vcpu, cr2))
Expand Down Expand Up @@ -5067,7 +5067,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason,
memset(c, 0, sizeof(struct decode_cache));
memcpy(c->regs, vcpu->arch.regs, sizeof c->regs);

ret = emulator_task_switch(&vcpu->arch.emulate_ctxt, &emulate_ops,
ret = emulator_task_switch(&vcpu->arch.emulate_ctxt,
tss_selector, reason, has_error_code,
error_code);

Expand Down Expand Up @@ -5424,6 +5424,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
BUG_ON(vcpu->kvm == NULL);
kvm = vcpu->kvm;

vcpu->arch.emulate_ctxt.ops = &emulate_ops;
vcpu->arch.mmu.root_hpa = INVALID_PAGE;
if (!irqchip_in_kernel(kvm) || kvm_vcpu_is_bsp(vcpu))
vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
Expand Down

0 comments on commit 98cd6c1

Please sign in to comment.