diff options
author | Gleb Natapov <gleb@redhat.com> | 2010-02-25 09:36:42 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-04-25 06:53:42 -0400 |
commit | e35b7b9c9e7d8768ee34e5904fed4cb0f2c2cb5d (patch) | |
tree | 376a4bc3dbd34c95e4f3aed914d275fc20f46769 /arch/x86/kvm/emulate.c | |
parent | 2d49ec72d3fab0aa90510a64a973d594c48b1fd1 (diff) |
KVM: x86 emulator: Add decoding of 16bit second in memory argument
Add decoding of Ep type of argument used by callf/jmpf.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r-- | arch/x86/kvm/emulate.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index c9f604b0819c..97a740368b30 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -85,6 +85,9 @@ | |||
85 | #define Src2ImmByte (2<<29) | 85 | #define Src2ImmByte (2<<29) |
86 | #define Src2One (3<<29) | 86 | #define Src2One (3<<29) |
87 | #define Src2Imm16 (4<<29) | 87 | #define Src2Imm16 (4<<29) |
88 | #define Src2Mem16 (5<<29) /* Used for Ep encoding. First argument has to be | ||
89 | in memory and second argument is located | ||
90 | immediately after the first one in memory. */ | ||
88 | #define Src2Mask (7<<29) | 91 | #define Src2Mask (7<<29) |
89 | 92 | ||
90 | enum { | 93 | enum { |
@@ -1163,6 +1166,10 @@ done_prefixes: | |||
1163 | c->src2.bytes = 1; | 1166 | c->src2.bytes = 1; |
1164 | c->src2.val = 1; | 1167 | c->src2.val = 1; |
1165 | break; | 1168 | break; |
1169 | case Src2Mem16: | ||
1170 | c->src2.bytes = 2; | ||
1171 | c->src2.type = OP_MEM; | ||
1172 | break; | ||
1166 | } | 1173 | } |
1167 | 1174 | ||
1168 | /* Decode and fetch the destination operand: register or memory. */ | 1175 | /* Decode and fetch the destination operand: register or memory. */ |
@@ -1881,6 +1888,17 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) | |||
1881 | c->src.orig_val = c->src.val; | 1888 | c->src.orig_val = c->src.val; |
1882 | } | 1889 | } |
1883 | 1890 | ||
1891 | if (c->src2.type == OP_MEM) { | ||
1892 | c->src2.ptr = (unsigned long *)(memop + c->src.bytes); | ||
1893 | c->src2.val = 0; | ||
1894 | rc = ops->read_emulated((unsigned long)c->src2.ptr, | ||
1895 | &c->src2.val, | ||
1896 | c->src2.bytes, | ||
1897 | ctxt->vcpu); | ||
1898 | if (rc != X86EMUL_CONTINUE) | ||
1899 | goto done; | ||
1900 | } | ||
1901 | |||
1884 | if ((c->d & DstMask) == ImplicitOps) | 1902 | if ((c->d & DstMask) == ImplicitOps) |
1885 | goto special_insn; | 1903 | goto special_insn; |
1886 | 1904 | ||