X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_quix86.c;h=480955a2b6e016ea728ea12fb49c0b37e9987721;hb=4d17b20a86eb8102a287263372458fcb9019c232;hp=fd64626d8fa6f2b870464ac6b2eb94f3a7b95105;hpb=3d68a569e5122ebb366d426d1e69f657a4201408;p=palacios.git diff --git a/palacios/src/palacios/vmm_quix86.c b/palacios/src/palacios/vmm_quix86.c index fd64626..480955a 100644 --- a/palacios/src/palacios/vmm_quix86.c +++ b/palacios/src/palacios/vmm_quix86.c @@ -7,8 +7,8 @@ * and the University of New Mexico. You can find out more at * http://www.v3vee.org * - * Copyright (c) 2011, Jack Lange - * Copyright (c) 2008, The V3VEE Project + * Copyright (c) 2012, Alexander Kudryavtsev + * Copyright (c) 2012, The V3VEE Project * All rights reserved. * * Author: Alexander Kudryavtsev @@ -49,7 +49,7 @@ static int get_opcode(qx86_insn *inst); static int qx86_register_to_v3_reg(struct guest_info * info, int qx86_reg, addr_t * v3_reg, uint_t * reg_len); -static int decode_string_op(struct guest_info * info, +static int decode_string_op(struct guest_info * core, const qx86_insn * qx86_inst, struct x86_instr * instr) { int status = 0; @@ -59,12 +59,13 @@ static int decode_string_op(struct guest_info * info, uint64_t a_mask = ~(~0ULL << (QX86_SIZE_OCTETS(qx86_inst->attributes.addressSize) * 8)); - instr->str_op_length = info->vm_regs.rcx & a_mask; + instr->str_op_length = core->vm_regs.rcx & a_mask; } else { instr->str_op_length = 1; } + if (instr->op_type == V3_OP_MOVS) { instr->num_operands = 2; @@ -75,6 +76,10 @@ static int decode_string_op(struct guest_info * info, return -1; } + instr->dst_operand.type = MEM_OPERAND; + instr->dst_operand.size = qx86_inst->operands[0].size; + + if((status = qx86_calculate_linear_address(qx86_inst, 1, (qx86_uint64*)&instr->src_operand.operand)) != QX86_SUCCESS) { PrintError("Could not get source memory operand: " @@ -82,9 +87,13 @@ static int decode_string_op(struct guest_info * info, return -1; } + instr->src_operand.type = MEM_OPERAND; + instr->src_operand.size = qx86_inst->operands[1].size; + instr->dst_operand.write = 1; instr->src_operand.read = 1; + } else if (instr->op_type == V3_OP_STOS) { instr->num_operands = 2; @@ -95,8 +104,11 @@ static int decode_string_op(struct guest_info * info, return -1; } + instr->dst_operand.type = MEM_OPERAND; + instr->dst_operand.size = qx86_inst->operands[0].size; + // STOS reads from rax - qx86_register_to_v3_reg(info, + qx86_register_to_v3_reg(core, qx86_inst->operands[1].u.r.rindex, &(instr->src_operand.operand), &(instr->src_operand.size)); instr->src_operand.type = REG_OPERAND; @@ -104,11 +116,21 @@ static int decode_string_op(struct guest_info * info, instr->src_operand.read = 1; instr->dst_operand.write = 1; + + } else { PrintError("Unhandled String OP\n"); return -1; } + +#ifdef V3_CONFIG_DEBUG_DECODER + V3_Print("Decoding Instr at %p\n", (void *)core->rip); + v3_print_instr(instr); + V3_Print("CS DB FLag=%x\n", core->segments.cs.db); +#endif + + return 0; }