int length = 0;
- PrintDebug("Decoding Instruction at %p\n", (void *)instr_ptr);
+ PrintDebug(core->vm_info, core, "Decoding Instruction at %p\n", (void *)instr_ptr);
memset(instr, 0, sizeof(struct x86_instr));
form = op_code_to_form((uint8_t *)(instr_ptr + length), &length);
- PrintDebug("\t decoded as (%s)\n", op_form_to_str(form));
+ PrintDebug(core->vm_info, core, "\t decoded as (%s)\n", op_form_to_str(form));
if (form == INVALID_INSTR) {
- PrintError("Could not find instruction form (%x)\n", *(uint32_t *)(instr_ptr + length));
+ PrintError(core->vm_info, core, "Could not find instruction form (%x)\n", *(uint32_t *)(instr_ptr + length));
return -1;
}
ret = parse_operands(core, (uint8_t *)(instr_ptr + length), instr, form);
if (ret == -1) {
- PrintError("Could not parse instruction operands\n");
+ PrintError(core->vm_info, core, "Could not parse instruction operands\n");
return -1;
}
length += ret;
instr->instr_length += length;
#ifdef V3_CONFIG_DEBUG_DECODER
- V3_Print("Decoding Instr at %p\n", (void *)core->rip);
+ V3_Print(core->vm_info, core, "Decoding Instr at %p\n", (void *)core->rip);
v3_print_instr(instr);
- V3_Print("CS DB FLag=%x\n", core->segments.cs.db);
+ V3_Print(core->vm_info, core, "CS DB FLag=%x\n", core->segments.cs.db);
#endif
return 0;
uint8_t * instr_start = instr_ptr;
- PrintDebug("\tOperand width=%d, Addr width=%d\n", operand_width, addr_width);
+ PrintDebug(core->vm_info, core, "\tOperand width=%d, Addr width=%d\n", operand_width, addr_width);
switch (form) {
case ADC_IMM2_8:
ret = decode_rm_operand(core, instr_ptr, form, instr, &(instr->dst_operand), ®_code);
if (ret == -1) {
- PrintError("Error decoding operand\n");
+ PrintError(core->vm_info, core, "Error decoding operand\n");
return -1;
}
} else if (operand_width == 8) {
instr->src_operand.operand = *(sint32_t *)instr_ptr; // This is a special case for sign extended 64bit ops
} else {
- PrintError("Illegal operand width (%d)\n", operand_width);
+ PrintError(core->vm_info, core, "Illegal operand width (%d)\n", operand_width);
return -1;
}
ret = decode_rm_operand(core, instr_ptr, form, instr, &(instr->dst_operand), ®_code);
if (ret == -1) {
- PrintError("Error decoding operand\n");
+ PrintError(core->vm_info, core, "Error decoding operand\n");
return -1;
}
ret = decode_rm_operand(core, instr_ptr, form, instr, &(instr->src_operand), ®_code);
if (ret == -1) {
- PrintError("Error decoding operand\n");
+ PrintError(core->vm_info, core, "Error decoding operand\n");
return -1;
}
instr->src_operand.size = 1;
if (ret == -1) {
- PrintError("Error decoding operand\n");
+ PrintError(core->vm_info, core, "Error decoding operand\n");
return -1;
}
instr->src_operand.size = 2;
if (ret == -1) {
- PrintError("Error decoding operand\n");
+ PrintError(core->vm_info, core, "Error decoding operand\n");
return -1;
}
ret = decode_rm_operand(core, instr_ptr, form, instr, &(instr->dst_operand), ®_code);
if (ret == -1) {
- PrintError("Error decoding operand\n");
+ PrintError(core->vm_info, core, "Error decoding operand\n");
return -1;
}
®_code);
if (ret == -1) {
- PrintError("Error decoding operand for (%s)\n", op_form_to_str(form));
+ PrintError(core->vm_info, core, "Error decoding operand for (%s)\n", op_form_to_str(form));
return -1;
}
®_code);
if (ret == -1) {
- PrintError("Error decoding operand for (%s)\n", op_form_to_str(form));
+ PrintError(core->vm_info, core, "Error decoding operand for (%s)\n", op_form_to_str(form));
return -1;
}
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));
+ PrintError(core->vm_info, core, "Error decoding operand for (%s)\n", op_form_to_str(form));
return -1;
}
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));
+ PrintError(core->vm_info, core, "Error decoding operand for (%s)\n", op_form_to_str(form));
return -1;
}
break;
}
default:
- PrintError("Invalid Instruction form: %s\n", op_form_to_str(form));
+ PrintError(core->vm_info, core, "Invalid Instruction form: %s\n", op_form_to_str(form));
return -1;
}