X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_decoder.h;h=80f8f127025a43edc8036320731b80e1ba5717af;hb=618756fd1cd3eb49db2a77202bcc26dedfd564b5;hp=767fe2520e3a24b18a8bf7a355b04f099efa80cd;hpb=24a5ce6f1a5f692c6f25bb14068c1a8549a16ac2;p=palacios.git diff --git a/palacios/include/palacios/vmm_decoder.h b/palacios/include/palacios/vmm_decoder.h index 767fe25..80f8f12 100644 --- a/palacios/include/palacios/vmm_decoder.h +++ b/palacios/include/palacios/vmm_decoder.h @@ -29,6 +29,12 @@ typedef enum { V3_INVALID_OP, V3_OP_MOVCR2, V3_OP_MOV2CR, V3_OP_SMSW, V3_OP_LMSW, V3_OP_CLTS, V3_OP_INVLPG, + /* 441-tm: adding CMP, POP, JLE, CALL, TEST*/ + V3_OP_CMP, V3_OP_POP, V3_OP_JLE, V3_OP_CALL, V3_OP_TEST, V3_OP_PUSH, + V3_OP_JAE, V3_OP_JMP, V3_OP_JNZ, V3_OP_JZ, V3_OP_LEA, V3_OP_IMUL, + V3_OP_RET, V3_OP_JL, V3_OP_CMOVZ, V3_OP_MOVSXD, V3_OP_JNS, + V3_OP_CMOVS, V3_OP_SHL, + V3_OP_ADC, V3_OP_ADD, V3_OP_AND, V3_OP_OR, V3_OP_XOR, V3_OP_SUB, V3_OP_INC, V3_OP_DEC, V3_OP_NEG, V3_OP_MOV, V3_OP_NOT, V3_OP_XCHG, V3_OP_SETB, V3_OP_SETBE, V3_OP_SETL, V3_OP_SETLE, V3_OP_SETNB, @@ -195,7 +201,7 @@ static inline v3_reg_t get_gpr_mask(struct guest_info * info) { case LONG: return 0xffffffffffffffffLL; default: - PrintError("Unsupported Address Mode\n"); + PrintError(info->vm_info, info, "Unsupported Address Mode\n"); return -1; } } @@ -204,26 +210,31 @@ static inline v3_reg_t get_gpr_mask(struct guest_info * info) { static inline addr_t get_addr_linear(struct guest_info * info, addr_t addr, struct v3_segment * seg) { switch (info->cpu_mode) { - case REAL: - // It appears that the segment values are computed and cached in the vmcb structure - // We Need to check this for Intel - /* return addr + (seg->selector << 4); - break;*/ - + case REAL: { + return ((seg->selector & 0xffff) << 4) + (addr & 0xffff); + break; + } case PROTECTED: case PROTECTED_PAE: case LONG_32_COMPAT: return addr + seg->base; break; - case LONG: + case LONG: { + uint64_t seg_base = 0; + // In long mode the segment bases are disregarded (forced to 0), unless using // FS or GS, then the base addresses are added - return addr + seg->base; + if (seg) { + seg_base = seg->base; + } + + return addr + seg_base; + } case LONG_16_COMPAT: default: - PrintError("Unsupported CPU Mode: %d\n", info->cpu_mode); + PrintError(info->vm_info, info,"Unsupported CPU Mode: %d\n", info->cpu_mode); return -1; } }