X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_xed.c;h=1aef74aa9b8e421d8638b9847b3544dc685c2de8;hb=ad81fe7841677f9c74046495369ef0240c5a3b61;hp=fedca7237e8c349bb292219540e9e2c394d41f4d;hpb=97cd5fe64c098b917e5519d30fd54c4b4e338b1c;p=palacios.git diff --git a/palacios/src/palacios/vmm_xed.c b/palacios/src/palacios/vmm_xed.c index fedca72..1aef74a 100644 --- a/palacios/src/palacios/vmm_xed.c +++ b/palacios/src/palacios/vmm_xed.c @@ -377,12 +377,15 @@ int v3_decode(struct guest_info * info, addr_t instr_ptr, struct x86_instr * ins struct x86_operand * v3_op = NULL; - if (xed_operand_written(op)) { + /* + if (xed_operand_written(op)) { v3_op = &(instr->dst_operand); - } else { + } else { v3_op = &(instr->src_operand); - } + } + */ + v3_op = &(instr->dst_operand); if (xed_operand_is_register(op_enum)) { xed_reg_enum_t xed_reg = xed_decoded_inst_get_reg(&xed_instr, op_enum); @@ -407,6 +410,7 @@ int v3_decode(struct guest_info * info, addr_t instr_ptr, struct x86_instr * ins case XED_OPERAND_MEM0: { + PrintDebug("Memory operand (1)\n"); if (get_memory_operand(info, &xed_instr, 0, v3_op) == -1) { PrintError("Could not get first memory operand\n"); return -1; @@ -442,12 +446,14 @@ int v3_decode(struct guest_info * info, addr_t instr_ptr, struct x86_instr * ins struct x86_operand * v3_op; - if (xed_operand_written(op)) { + /* + if (xed_operand_written(op)) { v3_op = &(instr->dst_operand); - } else { + } else { v3_op = &(instr->src_operand); - } - + } + */ + v3_op = &(instr->src_operand); if (xed_operand_is_register(op_enum)) { xed_reg_enum_t xed_reg = xed_decoded_inst_get_reg(&xed_instr, op_enum); @@ -473,6 +479,7 @@ int v3_decode(struct guest_info * info, addr_t instr_ptr, struct x86_instr * ins case XED_OPERAND_MEM0: { + PrintDebug("Memory operand (2)\n"); if (get_memory_operand(info, &xed_instr, 0, v3_op) == -1) { PrintError("Could not get first memory operand\n"); return -1; @@ -569,6 +576,7 @@ static int get_memory_operand(struct guest_info * info, xed_decoded_inst_t * xe addr_t scale; addr_t index; ullong_t displacement; + int addr_width = v3_get_addr_width(info);; // struct v3_segment * seg_reg; PrintDebug("Xen mode = %s\n", xed_machine_mode_enum_t2str(xed_state_get_machine_mode(info->decoder_state))); @@ -577,6 +585,8 @@ static int get_memory_operand(struct guest_info * info, xed_decoded_inst_t * xe PrintDebug("Stack Address width: %s\n", xed_address_width_enum_t2str(xed_state_get_stack_address_width(info->decoder_state))); + + memset((void*)&mem_op, '\0', sizeof(struct memory_operand)); xed_reg_enum_t xed_seg = xed_decoded_inst_get_seg_reg(xed_instr, op_index); @@ -655,7 +665,8 @@ static int get_memory_operand(struct guest_info * info, xed_decoded_inst_t * xe PrintDebug("Seg=%p, base=%p, index=%p, scale=%p, displacement=%p\n", (void *)seg, (void *)base, (void *)index, (void *)scale, (void *)(addr_t)displacement); - operand->operand = seg + base + (scale * index) + displacement; + operand->operand = MASK((seg + base + (scale * index) + displacement), addr_width); + return 0; }