Skip to content

Commit

Permalink
hv: instr_emul: add emulation for 0xf6 test instruction
Browse files Browse the repository at this point in the history
It is found that 0xf6 test instruction is used to access MMIO in
Windows. This patch added emulation for 0xf6 test instruction.

Tracked-On: #4310
Signed-off-by: Jian Jun Chen <[email protected]>
  • Loading branch information
chejianj authored and wenlingz committed Dec 30, 2019
1 parent ee74737 commit 5bf1f04
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions hypervisor/arch/x86/guest/instr_emul.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ static const struct instr_emul_vie_op one_byte_opcodes[256] = {
[0x85] = {
.op_type = VIE_OP_TYPE_TEST,
},
[0xF6] = {
.op_type = VIE_OP_TYPE_TEST,
.op_flags = VIE_OP_F_BYTE_OP,
},
[0x08] = {
.op_type = VIE_OP_TYPE_OR,
.op_flags = VIE_OP_F_BYTE_OP,
Expand Down Expand Up @@ -1218,6 +1222,20 @@ static int32_t emulate_test(struct acrn_vcpu *vcpu, const struct instr_emul_vie
error = 0;

switch (vie->opcode) {
case 0xF6U:
/*
* f6/0 ib test r/m8, imm8
*/
size = 1U;
/* get the first operand */
vie_mmio_read(vcpu, &val1);

/*
* perform the operation with the pre-fetched immediate
* operand and write the result
*/
result = val1 & vie->immediate;
break;
case 0x84U:
/*
* 84/r test r8, r/m8
Expand Down

0 comments on commit 5bf1f04

Please sign in to comment.