diff options
author | Gleb Natapov <gleb@redhat.com> | 2009-04-12 06:36:41 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-06-10 04:48:41 -0400 |
commit | 341de7e3728ade102eaadf56af404f4ce865a73d (patch) | |
tree | b849de0a8f174f72ba90cc31a35a3bf8752de035 | |
parent | d53c4777b3a3e5031710d0664851d1309325884b (diff) |
KVM: x86 emulator: Add unsigned byte immediate decode
Extend "Source operand type" opcode description field to 4 bites
to accommodate new option.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/x86/kvm/x86_emulate.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index 4a9cd4c2b98..0988a13063d 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c | |||
@@ -59,13 +59,14 @@ | |||
59 | #define SrcImm (5<<4) /* Immediate operand. */ | 59 | #define SrcImm (5<<4) /* Immediate operand. */ |
60 | #define SrcImmByte (6<<4) /* 8-bit sign-extended immediate operand. */ | 60 | #define SrcImmByte (6<<4) /* 8-bit sign-extended immediate operand. */ |
61 | #define SrcOne (7<<4) /* Implied '1' */ | 61 | #define SrcOne (7<<4) /* Implied '1' */ |
62 | #define SrcMask (7<<4) | 62 | #define SrcImmUByte (8<<4) /* 8-bit unsigned immediate operand. */ |
63 | #define SrcMask (0xf<<4) | ||
63 | /* Generic ModRM decode. */ | 64 | /* Generic ModRM decode. */ |
64 | #define ModRM (1<<7) | 65 | #define ModRM (1<<8) |
65 | /* Destination is only written; never read. */ | 66 | /* Destination is only written; never read. */ |
66 | #define Mov (1<<8) | 67 | #define Mov (1<<9) |
67 | #define BitOp (1<<9) | 68 | #define BitOp (1<<10) |
68 | #define MemAbs (1<<10) /* Memory operand is absolute displacement */ | 69 | #define MemAbs (1<<11) /* Memory operand is absolute displacement */ |
69 | #define String (1<<12) /* String instruction (rep capable) */ | 70 | #define String (1<<12) /* String instruction (rep capable) */ |
70 | #define Stack (1<<13) /* Stack instruction (push/pop) */ | 71 | #define Stack (1<<13) /* Stack instruction (push/pop) */ |
71 | #define Group (1<<14) /* Bits 3:5 of modrm byte extend opcode */ | 72 | #define Group (1<<14) /* Bits 3:5 of modrm byte extend opcode */ |
@@ -1044,10 +1045,14 @@ done_prefixes: | |||
1044 | } | 1045 | } |
1045 | break; | 1046 | break; |
1046 | case SrcImmByte: | 1047 | case SrcImmByte: |
1048 | case SrcImmUByte: | ||
1047 | c->src.type = OP_IMM; | 1049 | c->src.type = OP_IMM; |
1048 | c->src.ptr = (unsigned long *)c->eip; | 1050 | c->src.ptr = (unsigned long *)c->eip; |
1049 | c->src.bytes = 1; | 1051 | c->src.bytes = 1; |
1050 | c->src.val = insn_fetch(s8, 1, c->eip); | 1052 | if ((c->d & SrcMask) == SrcImmByte) |
1053 | c->src.val = insn_fetch(s8, 1, c->eip); | ||
1054 | else | ||
1055 | c->src.val = insn_fetch(u8, 1, c->eip); | ||
1051 | break; | 1056 | break; |
1052 | case SrcOne: | 1057 | case SrcOne: |
1053 | c->src.bytes = 1; | 1058 | c->src.bytes = 1; |