diff options
author | Andre Przywara <andre.przywara@amd.com> | 2009-06-17 09:50:33 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-09-10 01:33:00 -0400 |
commit | e99f0507125f45b723a9069e9e854c3c4758e7ba (patch) | |
tree | 97aa934ffe7e03361f60b5b07106ca6746f3cd92 | |
parent | b1d861431ed58f752b31e8c07da029072989bec7 (diff) |
KVM: x86 emulator: Prepare for emulation of syscall instructions
Add the flags needed for syscall, sysenter and sysexit to the opcode table.
Catch (but for now ignore) the opcodes in the emulation switch/case.
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Christoph Egger <christoph.egger@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/x86/kvm/x86_emulate.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index 67af33aeb3f3..b0da29d74032 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <asm/kvm_x86_emulate.h> | 33 | #include <asm/kvm_x86_emulate.h> |
34 | 34 | ||
35 | #include "mmu.h" /* for is_long_mode() */ | ||
36 | |||
35 | /* | 37 | /* |
36 | * Opcode effective-address decode tables. | 38 | * Opcode effective-address decode tables. |
37 | * Note that we only emulate instructions that have at least one memory | 39 | * Note that we only emulate instructions that have at least one memory |
@@ -209,7 +211,7 @@ static u32 opcode_table[256] = { | |||
209 | 211 | ||
210 | static u32 twobyte_table[256] = { | 212 | static u32 twobyte_table[256] = { |
211 | /* 0x00 - 0x0F */ | 213 | /* 0x00 - 0x0F */ |
212 | 0, Group | GroupDual | Group7, 0, 0, 0, 0, ImplicitOps, 0, | 214 | 0, Group | GroupDual | Group7, 0, 0, 0, ImplicitOps, ImplicitOps, 0, |
213 | ImplicitOps, ImplicitOps, 0, 0, 0, ImplicitOps | ModRM, 0, 0, | 215 | ImplicitOps, ImplicitOps, 0, 0, 0, ImplicitOps | ModRM, 0, 0, |
214 | /* 0x10 - 0x1F */ | 216 | /* 0x10 - 0x1F */ |
215 | 0, 0, 0, 0, 0, 0, 0, 0, ImplicitOps | ModRM, 0, 0, 0, 0, 0, 0, 0, | 217 | 0, 0, 0, 0, 0, 0, 0, 0, ImplicitOps | ModRM, 0, 0, 0, 0, 0, 0, 0, |
@@ -217,7 +219,9 @@ static u32 twobyte_table[256] = { | |||
217 | ModRM | ImplicitOps, ModRM, ModRM | ImplicitOps, ModRM, 0, 0, 0, 0, | 219 | ModRM | ImplicitOps, ModRM, ModRM | ImplicitOps, ModRM, 0, 0, 0, 0, |
218 | 0, 0, 0, 0, 0, 0, 0, 0, | 220 | 0, 0, 0, 0, 0, 0, 0, 0, |
219 | /* 0x30 - 0x3F */ | 221 | /* 0x30 - 0x3F */ |
220 | ImplicitOps, 0, ImplicitOps, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 222 | ImplicitOps, 0, ImplicitOps, 0, |
223 | ImplicitOps, ImplicitOps, 0, 0, | ||
224 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
221 | /* 0x40 - 0x47 */ | 225 | /* 0x40 - 0x47 */ |
222 | DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov, | 226 | DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov, |
223 | DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov, | 227 | DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov, |
@@ -1988,6 +1992,9 @@ twobyte_insn: | |||
1988 | goto cannot_emulate; | 1992 | goto cannot_emulate; |
1989 | } | 1993 | } |
1990 | break; | 1994 | break; |
1995 | case 0x05: /* syscall */ | ||
1996 | goto cannot_emulate; | ||
1997 | break; | ||
1991 | case 0x06: | 1998 | case 0x06: |
1992 | emulate_clts(ctxt->vcpu); | 1999 | emulate_clts(ctxt->vcpu); |
1993 | c->dst.type = OP_NONE; | 2000 | c->dst.type = OP_NONE; |
@@ -2054,6 +2061,12 @@ twobyte_insn: | |||
2054 | rc = X86EMUL_CONTINUE; | 2061 | rc = X86EMUL_CONTINUE; |
2055 | c->dst.type = OP_NONE; | 2062 | c->dst.type = OP_NONE; |
2056 | break; | 2063 | break; |
2064 | case 0x34: /* sysenter */ | ||
2065 | goto cannot_emulate; | ||
2066 | break; | ||
2067 | case 0x35: /* sysexit */ | ||
2068 | goto cannot_emulate; | ||
2069 | break; | ||
2057 | case 0x40 ... 0x4f: /* cmov */ | 2070 | case 0x40 ... 0x4f: /* cmov */ |
2058 | c->dst.val = c->dst.orig_val = c->src.val; | 2071 | c->dst.val = c->dst.orig_val = c->src.val; |
2059 | if (!test_cc(c->b, ctxt->eflags)) | 2072 | if (!test_cc(c->b, ctxt->eflags)) |