In VMX real mode, the return value of segment register from
getvcpucontext is corrupt.
Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
Signed-off-by: Akio Takebe <takebe_akio@xxxxxxxxxxxxxx>
diff -r 5fd51e1e9c79 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c Wed Nov 05 10:57:21 2008 +0000
+++ b/xen/arch/x86/domctl.c Tue Nov 11 13:22:56 2008 +0900
@@ -1079,6 +1079,7 @@ void arch_get_info_guest(struct vcpu *v,
c.nat->ctrlreg[2] = v->arch.hvm_vcpu.guest_cr[2];
c.nat->ctrlreg[3] = v->arch.hvm_vcpu.guest_cr[3];
c.nat->ctrlreg[4] = v->arch.hvm_vcpu.guest_cr[4];
+ hvm_get_info_guest(c.nat, v);
}
else
{
diff -r 5fd51e1e9c79 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c Wed Nov 05 10:57:21 2008 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c Tue Nov 11 13:22:56 2008 +0900
@@ -1193,6 +1193,28 @@ static void vmx_set_info_guest(struct vc
vmx_vmcs_exit(v);
}
+static void vmx_get_info_guest(struct vcpu_guest_context *nat, struct vcpu *v)
+{
+ struct cpu_user_regs *regs = &nat->user_regs;
+ struct segment_register sreg;
+
+ if ( v->arch.hvm_vmx.vmxemul & VMXEMUL_REALMODE )
+ {
+ hvm_get_segment_register(v, x86_seg_cs, &sreg);
+ regs->cs = sreg.sel;
+ hvm_get_segment_register(v, x86_seg_ss, &sreg);
+ regs->ss = sreg.sel;
+ hvm_get_segment_register(v, x86_seg_ds, &sreg);
+ regs->ds = sreg.sel;
+ hvm_get_segment_register(v, x86_seg_es, &sreg);
+ regs->es = sreg.sel;
+ hvm_get_segment_register(v, x86_seg_fs, &sreg);
+ regs->fs = sreg.sel;
+ hvm_get_segment_register(v, x86_seg_gs, &sreg);
+ regs->gs = sreg.sel;
+ }
+}
+
static struct hvm_function_table vmx_function_table = {
.name = "VMX",
.domain_initialise = vmx_domain_initialise,
@@ -1224,7 +1246,8 @@ static struct hvm_function_table vmx_fun
.msr_write_intercept = vmx_msr_write_intercept,
.invlpg_intercept = vmx_invlpg_intercept,
.set_uc_mode = vmx_set_uc_mode,
- .set_info_guest = vmx_set_info_guest
+ .set_info_guest = vmx_set_info_guest,
+ .get_info_guest = vmx_get_info_guest
};
static unsigned long *vpid_bitmap;
diff -r 5fd51e1e9c79 xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h Wed Nov 05 10:57:21 2008 +0000
+++ b/xen/include/asm-x86/hvm/hvm.h Tue Nov 11 13:22:56 2008 +0900
@@ -129,6 +129,7 @@ struct hvm_function_table {
void (*invlpg_intercept)(unsigned long vaddr);
void (*set_uc_mode)(struct vcpu *v);
void (*set_info_guest)(struct vcpu *v);
+ void (*get_info_guest)(struct vcpu_guest_context *nat, struct vcpu *v);
};
extern struct hvm_function_table hvm_funcs;
@@ -321,4 +322,11 @@ static inline void hvm_set_info_guest(st
return hvm_funcs.set_info_guest(v);
}
+static inline void hvm_get_info_guest(
+ struct vcpu_guest_context *nat, struct vcpu *v)
+{
+ if ( hvm_funcs.get_info_guest )
+ return hvm_funcs.get_info_guest(nat, v);
+}
+
#endif /* __ASM_X86_HVM_HVM_H__ */
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|