X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_decoder.h;h=80f8f127025a43edc8036320731b80e1ba5717af;hb=6b9abb54ebafd8266f1711b803ccb027675a465f;hp=7f33fde55672abd9e6da206d749ff8df3a71229b;hpb=7d80144eeb8dc7f5bb48975a7d7ab0d3b126d795;p=palacios.git diff --git a/palacios/include/palacios/vmm_decoder.h b/palacios/include/palacios/vmm_decoder.h index 7f33fde..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, @@ -52,29 +58,31 @@ struct x86_prefixes { uint32_t val; struct { - uint_t lock : 1; // 0xF0 - uint_t repne : 1; // 0xF2 - uint_t repnz : 1; // 0xF2 - uint_t rep : 1; // 0xF3 - uint_t repe : 1; // 0xF3 - uint_t repz : 1; // 0xF3 - uint_t cs_override : 1; // 0x2E - uint_t ss_override : 1; // 0x36 - uint_t ds_override : 1; // 0x3E - uint_t es_override : 1; // 0x26 - uint_t fs_override : 1; // 0x64 - uint_t gs_override : 1; // 0x65 - uint_t br_not_taken : 1; // 0x2E - uint_t br_taken : 1; // 0x3E - uint_t op_size : 1; // 0x66 - uint_t addr_size : 1; // 0x67 - - uint_t rex : 1; + uint32_t lock : 1; // 0xF0 + uint32_t repne : 1; // 0xF2 + uint32_t repnz : 1; // 0xF2 + uint32_t rep : 1; // 0xF3 + uint32_t repe : 1; // 0xF3 + uint32_t repz : 1; // 0xF3 + uint32_t cs_override : 1; // 0x2E + uint32_t ss_override : 1; // 0x36 + uint32_t ds_override : 1; // 0x3E + uint32_t es_override : 1; // 0x26 + uint32_t fs_override : 1; // 0x64 + uint32_t gs_override : 1; // 0x65 + uint32_t br_not_taken : 1; // 0x2E + uint32_t br_taken : 1; // 0x3E + uint32_t op_size : 1; // 0x66 + uint32_t addr_size : 1; // 0x67 + + uint32_t rex : 1; - uint_t rex_rm : 1; // REX.B - uint_t rex_sib_idx : 1; // REX.X - uint_t rex_reg : 1; // REX.R - uint_t rex_op_size : 1; // REX.W + uint32_t rex_rm : 1; // REX.B + uint32_t rex_sib_idx : 1; // REX.X + uint32_t rex_reg : 1; // REX.R + uint32_t rex_op_size : 1; // REX.W + + uint32_t rsvd : 11; } __attribute__((packed)); } __attribute__((packed)); } __attribute__((packed)); @@ -193,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; } } @@ -202,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; } }