case LONG:
return 0xffffffffffffffffLL;
default:
- PrintError("Unsupported Address Mode\n");
+ PrintError(info->vm_info, info, "Unsupported Address Mode\n");
return -1;
}
}
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;
}
}