diff options
author | Nitin A Kamble <nitin.a.kamble@intel.com> | 2007-08-19 04:00:36 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-10-13 04:18:24 -0400 |
commit | 098c937ba30acc5b7dcb6a4ad7cc8d63c7117546 (patch) | |
tree | ce611f0ff8ebad545c6664c25602b75cfe9605a7 /drivers/kvm/x86_emulate.c | |
parent | 19eb938e0115693414a83b6bde2b67896bd9953a (diff) |
KVM: x86 emulator: implement 'jmp rel' instruction (opcode 0xe9)
Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/x86_emulate.c')
-rw-r--r-- | drivers/kvm/x86_emulate.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c index 2b94d16e9d23..fa7aa278956f 100644 --- a/drivers/kvm/x86_emulate.c +++ b/drivers/kvm/x86_emulate.c | |||
@@ -145,8 +145,10 @@ static u8 opcode_table[256] = { | |||
145 | 0, 0, 0, 0, | 145 | 0, 0, 0, 0, |
146 | /* 0xD8 - 0xDF */ | 146 | /* 0xD8 - 0xDF */ |
147 | 0, 0, 0, 0, 0, 0, 0, 0, | 147 | 0, 0, 0, 0, 0, 0, 0, 0, |
148 | /* 0xE0 - 0xEF */ | 148 | /* 0xE0 - 0xE7 */ |
149 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 149 | 0, 0, 0, 0, 0, 0, 0, 0, |
150 | /* 0xE8 - 0xEF */ | ||
151 | 0, SrcImm|ImplicitOps, 0, 0, 0, 0, 0, 0, | ||
150 | /* 0xF0 - 0xF7 */ | 152 | /* 0xF0 - 0xF7 */ |
151 | 0, 0, 0, 0, | 153 | 0, 0, 0, 0, |
152 | ImplicitOps, 0, | 154 | ImplicitOps, 0, |
@@ -447,6 +449,12 @@ struct operand { | |||
447 | (((reg) + _inc) & ((1UL << (ad_bytes << 3)) - 1)); \ | 449 | (((reg) + _inc) & ((1UL << (ad_bytes << 3)) - 1)); \ |
448 | } while (0) | 450 | } while (0) |
449 | 451 | ||
452 | #define JMP_REL(rel) \ | ||
453 | do { \ | ||
454 | _eip += (int)(rel); \ | ||
455 | _eip = ((op_bytes == 2) ? (uint16_t)_eip : (uint32_t)_eip); \ | ||
456 | } while (0) | ||
457 | |||
450 | /* | 458 | /* |
451 | * Given the 'reg' portion of a ModRM byte, and a register block, return a | 459 | * Given the 'reg' portion of a ModRM byte, and a register block, return a |
452 | * pointer into the block that addresses the relevant register. | 460 | * pointer into the block that addresses the relevant register. |
@@ -1023,6 +1031,10 @@ done_prefixes: | |||
1023 | case 0xd2 ... 0xd3: /* Grp2 */ | 1031 | case 0xd2 ... 0xd3: /* Grp2 */ |
1024 | src.val = _regs[VCPU_REGS_RCX]; | 1032 | src.val = _regs[VCPU_REGS_RCX]; |
1025 | goto grp2; | 1033 | goto grp2; |
1034 | case 0xe9: /* jmp rel */ | ||
1035 | JMP_REL(src.val); | ||
1036 | no_wb = 1; /* Disable writeback. */ | ||
1037 | break; | ||
1026 | case 0xf6 ... 0xf7: /* Grp3 */ | 1038 | case 0xf6 ... 0xf7: /* Grp3 */ |
1027 | switch (modrm_reg) { | 1039 | switch (modrm_reg) { |
1028 | case 0 ... 1: /* test */ | 1040 | case 0 ... 1: /* test */ |