Skip to content

Commit

Permalink
KVM: x86 emulator: Support for declaring single operand fastops
Browse files Browse the repository at this point in the history
Acked-by: Gleb Natapov <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>
  • Loading branch information
avikivity authored and matosatti committed Jan 9, 2013
1 parent e28bbd4 commit b7d491e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "kvm_cache_regs.h"
#include <linux/module.h>
#include <asm/kvm_emulate.h>
#include <linux/stringify.h>

#include "x86.h"
#include "tss.h"
Expand Down Expand Up @@ -439,6 +440,30 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
} \
} while (0)

#define FOP_ALIGN ".align " __stringify(FASTOP_SIZE) " \n\t"
#define FOP_RET "ret \n\t"

#define FOP_START(op) \
extern void em_##op(struct fastop *fake); \
asm(".pushsection .text, \"ax\" \n\t" \
".global em_" #op " \n\t" \
FOP_ALIGN \
"em_" #op ": \n\t"

#define FOP_END \
".popsection")

#define FOP1E(op, dst) \
FOP_ALIGN #op " %" #dst " \n\t" FOP_RET

#define FASTOP1(op) \
FOP_START(op) \
FOP1E(op##b, al) \
FOP1E(op##w, ax) \
FOP1E(op##l, eax) \
ON64(FOP1E(op##q, rax)) \
FOP_END

#define __emulate_1op_rax_rdx(ctxt, _op, _suffix, _ex) \
do { \
unsigned long _tmp; \
Expand Down

0 comments on commit b7d491e

Please sign in to comment.