X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_decoder.h;h=c2686d9df3af2b16bab4f97989f3de33b99a2028;hb=b5380c0aecad02964d5aff23ab51979a063379ce;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..c2686d9 100644 --- a/palacios/include/palacios/vmm_decoder.h +++ b/palacios/include/palacios/vmm_decoder.h @@ -195,7 +195,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 +204,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; } }