aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity <avi.kivity@gmail.com>2013-01-04 09:18:49 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2013-01-09 14:39:17 -0500
commitb7d491e7f065b5b957a27a65c9e7cd3ef96b2736 (patch)
tree6ee28b2f87e8eb3145dac13e047045a076c9660c
parente28bbd44dad134046ef9463cbb8c1cf81f53de5e (diff)
KVM: x86 emulator: Support for declaring single operand fastops
Acked-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi.kivity@gmail.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--arch/x86/kvm/emulate.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index dd71567d7c71..42c53c8071be 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -24,6 +24,7 @@
24#include "kvm_cache_regs.h" 24#include "kvm_cache_regs.h"
25#include <linux/module.h> 25#include <linux/module.h>
26#include <asm/kvm_emulate.h> 26#include <asm/kvm_emulate.h>
27#include <linux/stringify.h>
27 28
28#include "x86.h" 29#include "x86.h"
29#include "tss.h" 30#include "tss.h"
@@ -439,6 +440,30 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
439 } \ 440 } \
440 } while (0) 441 } while (0)
441 442
443#define FOP_ALIGN ".align " __stringify(FASTOP_SIZE) " \n\t"
444#define FOP_RET "ret \n\t"
445
446#define FOP_START(op) \
447 extern void em_##op(struct fastop *fake); \
448 asm(".pushsection .text, \"ax\" \n\t" \
449 ".global em_" #op " \n\t" \
450 FOP_ALIGN \
451 "em_" #op ": \n\t"
452
453#define FOP_END \
454 ".popsection")
455
456#define FOP1E(op, dst) \
457 FOP_ALIGN #op " %" #dst " \n\t" FOP_RET
458
459#define FASTOP1(op) \
460 FOP_START(op) \
461 FOP1E(op##b, al) \
462 FOP1E(op##w, ax) \
463 FOP1E(op##l, eax) \
464 ON64(FOP1E(op##q, rax)) \
465 FOP_END
466
442#define __emulate_1op_rax_rdx(ctxt, _op, _suffix, _ex) \ 467#define __emulate_1op_rax_rdx(ctxt, _op, _suffix, _ex) \
443 do { \ 468 do { \
444 unsigned long _tmp; \ 469 unsigned long _tmp; \