WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] vmx: fix getvcpucontext about segment registers

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] vmx: fix getvcpucontext about segment registers in real mode
From: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
Date: Tue, 11 Nov 2008 18:30:10 +0900
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 11 Nov 2008 01:30:39 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C53EF307.1F1E4%keir.fraser@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <7kbpwmemor.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxx> <C53EF307.1F1E4%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Keir Fraser writes:
> On 11/11/08 07:39, "Kouya Shimura" <kouya@xxxxxxxxxxxxxx> wrote:
> 
> > In VMX real mode, the return value of segment register from
> > getvcpucontext is corrupt.
> > 
> This isn't unique to VMX realmode. The code you added is actually
> HVM-generic and belongs directly in arch_get_info_guest() for all SVM and
> VMX execution modes.
> 
>  -- Keir
> 

Okay. Revised patch attached.
Actually I'm not familiar with SVM.

Thanks,
Kouya


x86: fix getvcpucontext about segment registers in real mode

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 17:54:16 2008 +0900
@@ -1079,6 +1079,24 @@ 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];
+        if ( !(v->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE) )
+        {
+            struct cpu_user_regs *regs = &c.nat->user_regs;
+            struct segment_register sreg;
+
+            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;
+        }
     }
     else
     {
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>