X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_v3dec.c;h=74c8c56b66d01508cff49e6d6f8bccc0a840b886;hb=0a4bd37f65c15fe50680e51b68f3f95ec8d347ea;hp=1b2436f38c0127e24d549280e4e26875ae414ca4;hpb=03715266180ca2d9ea6ca4bbd9151d0017cefa49;p=palacios-OLD.git diff --git a/palacios/src/palacios/vmm_v3dec.c b/palacios/src/palacios/vmm_v3dec.c index 1b2436f..74c8c56 100644 --- a/palacios/src/palacios/vmm_v3dec.c +++ b/palacios/src/palacios/vmm_v3dec.c @@ -165,6 +165,7 @@ static int parse_operands(struct guest_info * core, uint8_t * instr_ptr, instr->src_operand.type = IMM_OPERAND; instr->src_operand.size = operand_width; + if (operand_width == 1) { instr->src_operand.operand = *(uint8_t *)instr_ptr; } else if (operand_width == 2) { @@ -176,6 +177,9 @@ static int parse_operands(struct guest_info * core, uint8_t * instr_ptr, return -1; } + instr->src_operand.read = 1; + instr->dst_operand.write = 1; + instr_ptr += operand_width; instr->num_operands = 2; @@ -210,6 +214,10 @@ static int parse_operands(struct guest_info * core, uint8_t * instr_ptr, instr->src_operand.type = REG_OPERAND; instr->src_operand.size = operand_width; + instr->src_operand.read = 1; + instr->dst_operand.write = 1; + + decode_gpr(core, reg_code, &(instr->src_operand)); instr->num_operands = 2; @@ -244,6 +252,9 @@ static int parse_operands(struct guest_info * core, uint8_t * instr_ptr, instr->dst_operand.type = REG_OPERAND; decode_gpr(core, reg_code, &(instr->dst_operand)); + instr->src_operand.read = 1; + instr->dst_operand.write = 1; + instr->num_operands = 2; break; @@ -256,7 +267,8 @@ static int parse_operands(struct guest_info * core, uint8_t * instr_ptr, case XOR_IMM2SX_8: { uint8_t reg_code = 0; - ret = decode_rm_operand(core, instr_ptr, form, instr, &(instr->src_operand), ®_code); + ret = decode_rm_operand(core, instr_ptr, form, instr, &(instr->dst_operand), ®_code); + if (ret == -1) { PrintError("Error decoding operand\n"); @@ -269,6 +281,9 @@ static int parse_operands(struct guest_info * core, uint8_t * instr_ptr, instr->src_operand.size = operand_width; instr->src_operand.operand = *(sint8_t *)instr_ptr; // sign extend. + instr->src_operand.read = 1; + instr->dst_operand.write = 1; + instr_ptr += 1; instr->num_operands = 2; @@ -292,10 +307,15 @@ static int parse_operands(struct guest_info * core, uint8_t * instr_ptr, instr->src_operand.size = operand_width; instr->src_operand.operand = get_addr_linear(core, MASK(core->vm_regs.rsi, addr_width), &(core->segments.ds)); + instr->dst_operand.type = MEM_OPERAND; instr->dst_operand.size = operand_width; instr->dst_operand.operand = get_addr_linear(core, MASK(core->vm_regs.rdi, addr_width), &(core->segments.es)); + + instr->src_operand.read = 1; + instr->dst_operand.write = 1; + instr->num_operands = 2; break; @@ -317,6 +337,9 @@ static int parse_operands(struct guest_info * core, uint8_t * instr_ptr, instr->dst_operand.size = operand_width; decode_cr(core, reg_code, &(instr->dst_operand)); + instr->src_operand.read = 1; + instr->dst_operand.write = 1; + instr->num_operands = 2; break; } @@ -326,6 +349,7 @@ static int parse_operands(struct guest_info * core, uint8_t * instr_ptr, ret = decode_rm_operand(core, instr_ptr, form, instr, &(instr->dst_operand), ®_code); + if (ret == -1) { PrintError("Error decoding operand for (%s)\n", op_form_to_str(form)); return -1; @@ -337,6 +361,9 @@ static int parse_operands(struct guest_info * core, uint8_t * instr_ptr, instr->src_operand.size = operand_width; decode_cr(core, reg_code, &(instr->src_operand)); + instr->src_operand.read = 1; + instr->dst_operand.write = 1; + instr->num_operands = 2; break; } @@ -358,6 +385,9 @@ static int parse_operands(struct guest_info * core, uint8_t * instr_ptr, instr->dst_operand.size = operand_width; instr->dst_operand.operand = get_addr_linear(core, MASK(core->vm_regs.rdi, addr_width), &(core->segments.es)); + instr->src_operand.read = 1; + instr->dst_operand.write = 1; + instr->num_operands = 2; break; @@ -365,8 +395,6 @@ static int parse_operands(struct guest_info * core, uint8_t * instr_ptr, case INVLPG: { uint8_t reg_code = 0; - // We use the dst operand here to maintain bug-for-bug compatibility with XED - ret = decode_rm_operand(core, instr_ptr, form, instr, &(instr->dst_operand), ®_code); if (ret == -1) {