Skip to content

Commit

Permalink
KVM: x86: Use a typedef for fastop functions
Browse files Browse the repository at this point in the history
Add a typedef to for the fastop function prototype to make the code more
readable.

No functional change intended.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Sean Christopherson authored and Paolo Bonzini committed Jan 27, 2020
1 parent 52db369 commit 3009afc
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
#define ON64(x)
#endif

static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *));
typedef void (*fastop_t)(struct fastop *);

static int fastop(struct x86_emulate_ctxt *ctxt, fastop_t fop);

#define __FOP_FUNC(name) \
".align " __stringify(FASTOP_SIZE) " \n\t" \
Expand Down Expand Up @@ -5502,7 +5504,7 @@ static void fetch_possible_mmx_operand(struct operand *op)
read_mmx_reg(&op->mm_val, op->addr.mm);
}

static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *))
static int fastop(struct x86_emulate_ctxt *ctxt, fastop_t fop)
{
ulong flags = (ctxt->eflags & EFLAGS_MASK) | X86_EFLAGS_IF;

Expand Down Expand Up @@ -5680,12 +5682,10 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
ctxt->eflags &= ~X86_EFLAGS_RF;

if (ctxt->execute) {
if (ctxt->d & Fastop) {
void (*fop)(struct fastop *) = (void *)ctxt->execute;
rc = fastop(ctxt, fop);
} else {
if (ctxt->d & Fastop)
rc = fastop(ctxt, (fastop_t)ctxt->execute);
else
rc = ctxt->execute(ctxt);
}
if (rc != X86EMUL_CONTINUE)
goto done;
goto writeback;
Expand Down

0 comments on commit 3009afc

Please sign in to comment.