Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125283
b: refs/heads/master
c: 0dc8d10
h: refs/heads/master
i:
  125281: 98f2c81
  125279: e20991d
v: v3
  • Loading branch information
Guillaume Thouvenin authored and Avi Kivity committed Dec 31, 2008
1 parent 8f0b551 commit b63bfa0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 45ed60b371aeae6ed80f7e9d594a5e6412edc176
refs/heads/master: 0dc8d10f7d848b63c8d32cf6fd31ba7def792ac9
1 change: 1 addition & 0 deletions trunk/arch/x86/include/asm/kvm_x86_emulate.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ struct decode_cache {
u8 ad_bytes;
u8 rex_prefix;
struct operand src;
struct operand src2;
struct operand dst;
bool has_seg_override;
u8 seg_override;
Expand Down
29 changes: 29 additions & 0 deletions trunk/arch/x86/kvm/x86_emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@
#define Group (1<<14) /* Bits 3:5 of modrm byte extend opcode */
#define GroupDual (1<<15) /* Alternate decoding of mod == 3 */
#define GroupMask 0xff /* Group number stored in bits 0:7 */
/* Source 2 operand type */
#define Src2None (0<<29)
#define Src2CL (1<<29)
#define Src2ImmByte (2<<29)
#define Src2One (3<<29)
#define Src2Mask (7<<29)

enum {
Group1_80, Group1_81, Group1_82, Group1_83,
Expand Down Expand Up @@ -1000,6 +1006,29 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
break;
}

/*
* Decode and fetch the second source operand: register, memory
* or immediate.
*/
switch (c->d & Src2Mask) {
case Src2None:
break;
case Src2CL:
c->src2.bytes = 1;
c->src2.val = c->regs[VCPU_REGS_RCX] & 0x8;
break;
case Src2ImmByte:
c->src2.type = OP_IMM;
c->src2.ptr = (unsigned long *)c->eip;
c->src2.bytes = 1;
c->src2.val = insn_fetch(u8, 1, c->eip);
break;
case Src2One:
c->src2.bytes = 1;
c->src2.val = 1;
break;
}

/* Decode and fetch the destination operand: register or memory. */
switch (c->d & DstMask) {
case ImplicitOps:
Expand Down

0 comments on commit b63bfa0

Please sign in to comment.