aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/emulate.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-08-01 07:46:54 -0400
committerAvi Kivity <avi@redhat.com>2010-10-24 04:50:35 -0400
commit7f9b4b75be866de938a3094413a60554f7e66e4d (patch)
tree594a6b226728d1a3ef04b81c6e90ce948bdc3eed /arch/x86/kvm/emulate.c
parent1e87e3efe764285133866a14ddc71cf211f022c2 (diff)
KVM: x86 emulator: introduce Op3264 for mov cr and mov dr instructions
The operands for these instructions are 32 bits or 64 bits, depending on long mode, and ignoring REX prefixes, or the operand size prefix. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r--arch/x86/kvm/emulate.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index a832019138f3..b7adfcc2f74f 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -83,6 +83,7 @@
83#define Group (1<<14) /* Bits 3:5 of modrm byte extend opcode */ 83#define Group (1<<14) /* Bits 3:5 of modrm byte extend opcode */
84#define GroupDual (1<<15) /* Alternate decoding of mod == 3 */ 84#define GroupDual (1<<15) /* Alternate decoding of mod == 3 */
85/* Misc flags */ 85/* Misc flags */
86#define Op3264 (1<<24) /* Operand is 64b in long mode, 32b otherwise */
86#define Undefined (1<<25) /* No Such Instruction */ 87#define Undefined (1<<25) /* No Such Instruction */
87#define Lock (1<<26) /* lock prefix is allowed for the instruction */ 88#define Lock (1<<26) /* lock prefix is allowed for the instruction */
88#define Priv (1<<27) /* instruction generates #GP if current CPL != 0 */ 89#define Priv (1<<27) /* instruction generates #GP if current CPL != 0 */
@@ -2406,6 +2407,13 @@ done_prefixes:
2406 if (mode == X86EMUL_MODE_PROT64 && (c->d & Stack)) 2407 if (mode == X86EMUL_MODE_PROT64 && (c->d & Stack))
2407 c->op_bytes = 8; 2408 c->op_bytes = 8;
2408 2409
2410 if (c->d & Op3264) {
2411 if (mode == X86EMUL_MODE_PROT64)
2412 c->op_bytes = 8;
2413 else
2414 c->op_bytes = 4;
2415 }
2416
2409 /* ModRM and SIB bytes. */ 2417 /* ModRM and SIB bytes. */
2410 if (c->d & ModRM) { 2418 if (c->d & ModRM) {
2411 rc = decode_modrm(ctxt, ops); 2419 rc = decode_modrm(ctxt, ops);