Emulate the "OR reg, r/m" instruction (opcode 0BH).
This is needed for the HDA emulation with FreeBSD guests. Reviewed by: marcelo MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12832
This commit is contained in:
parent
7561a31ed9
commit
9d210a4a18
@ -109,6 +109,10 @@ static const struct vie_op one_byte_opcodes[256] = {
|
||||
.op_byte = 0x0F,
|
||||
.op_type = VIE_OP_TYPE_TWO_BYTE
|
||||
},
|
||||
[0x0B] = {
|
||||
.op_byte = 0x0B,
|
||||
.op_type = VIE_OP_TYPE_OR,
|
||||
},
|
||||
[0x2B] = {
|
||||
.op_byte = 0x2B,
|
||||
.op_type = VIE_OP_TYPE_SUB,
|
||||
@ -992,12 +996,38 @@ emulate_or(void *vm, int vcpuid, uint64_t gpa, struct vie *vie,
|
||||
mem_region_read_t memread, mem_region_write_t memwrite, void *arg)
|
||||
{
|
||||
int error, size;
|
||||
uint64_t val1, result, rflags, rflags2;
|
||||
enum vm_reg_name reg;
|
||||
uint64_t result, rflags, rflags2, val1, val2;
|
||||
|
||||
size = vie->opsize;
|
||||
error = EINVAL;
|
||||
|
||||
switch (vie->op.op_byte) {
|
||||
case 0x0B:
|
||||
/*
|
||||
* OR reg (ModRM:reg) and mem (ModRM:r/m) and store the
|
||||
* result in reg.
|
||||
*
|
||||
* 0b/r or r16, r/m16
|
||||
* 0b/r or r32, r/m32
|
||||
* REX.W + 0b/r or r64, r/m64
|
||||
*/
|
||||
|
||||
/* get the first operand */
|
||||
reg = gpr_map[vie->reg];
|
||||
error = vie_read_register(vm, vcpuid, reg, &val1);
|
||||
if (error)
|
||||
break;
|
||||
|
||||
/* get the second operand */
|
||||
error = memread(vm, vcpuid, gpa, &val2, size, arg);
|
||||
if (error)
|
||||
break;
|
||||
|
||||
/* perform the operation and write the result */
|
||||
result = val1 | val2;
|
||||
error = vie_update_register(vm, vcpuid, reg, result, size);
|
||||
break;
|
||||
case 0x81:
|
||||
case 0x83:
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user