From: Bastian Blank Subject: Re: [RFC][PATCH] Emulate instructions in vm86 mode Date: Fri, 8 Sep 2006 22:58:44 +0200 Message-ID: <20060908205844.GA2496@wavehammer.waldi.eu.org> References: <20060907135951.GA9616@wavehammer.waldi.eu.org> <20060908193744.GB29097@wavehammer.waldi.eu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1302923258==" Return-path: In-Reply-To: <20060908193744.GB29097@wavehammer.waldi.eu.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============1302923258== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FkmkrVfFsRoUs1wW" Content-Disposition: inline --FkmkrVfFsRoUs1wW Content-Type: multipart/mixed; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 08, 2006 at 09:37:44PM +0200, Bastian Blank wrote: > On Thu, Sep 07, 2006 at 06:17:58PM +0100, Keir Fraser wrote: > > The trap bounce code clears fs and gs too, just as native hardware does= on > > an exception while in vm86 mode. The real values are saved on the excep= tion > > stack frame (hopefully!). > Hmm, the code write 0 for this values to the exception frame in VM86 > mode, lets check if this is the problem. It seems that this is the problem. The following patch always bounces traps in vm86 mode to the guest kernel and don't longer clears the segment register values in the exception frame. Signed-off-by: Bastian Blank Bastian --=20 The sooner our happiness together begins, the longer it will last. -- Miramanee, "The Paradise Syndrome", stardate 4842.6 --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename=diff Content-Transfer-Encoding: quoted-printable #! /bin/sh /usr/share/dpatch/dpatch-run ## vm86-support-2.dpatch by Bastian Blank ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: No description. @DPATCH@ diff -urNad xen-unstable~/xen/arch/x86/traps.c xen-unstable/xen/arch/x86/tr= aps.c --- xen-unstable~/xen/arch/x86/traps.c 2006-08-30 18:36:52.000000000 +0200 +++ xen-unstable/xen/arch/x86/traps.c 2006-09-08 22:32:36.000000000 +0200 @@ -1032,6 +1032,9 @@ unsigned int port, i, op_bytes =3D 4, data, rc; u32 l, h; =20 + if ( vm86_mode(regs) ) + goto fail; + /* Legacy prefixes. */ for ( i =3D 0; i < 8; i++ ) { diff -urNad xen-unstable~/xen/arch/x86/x86_32/entry.S xen-unstable/xen/arch= /x86/x86_32/entry.S --- xen-unstable~/xen/arch/x86/x86_32/entry.S 2006-08-30 18:36:52.000000000= +0200 +++ xen-unstable/xen/arch/x86/x86_32/entry.S 2006-09-08 22:36:02.000000000 = +0200 @@ -331,15 +331,7 @@ 1: testb $TBF_FAILSAFE,%cl jz 2f subl $16,%esi # add DS/ES/FS/GS to failsafe stack f= rame - testl $X86_EFLAGS_VM,UREGS_eflags+4(%esp) - jz nvm86_2 - xorl %eax,%eax # VM86: we write zero selector values -FLT18: movl %eax,%gs:(%esi)=20 -FLT19: movl %eax,%gs:4(%esi) -FLT20: movl %eax,%gs:8(%esi)=20 -FLT21: movl %eax,%gs:12(%esi) - jmp 2f -nvm86_2:movl UREGS_ds+4(%esp),%eax # non-VM86: write real selector values + movl UREGS_ds+4(%esp),%eax FLT22: movl %eax,%gs:(%esi)=20 movl UREGS_es+4(%esp),%eax FLT23: movl %eax,%gs:4(%esi) @@ -375,8 +367,6 @@ .long FLT12,domain_crash_synchronous , FLT13,domain_crash_synchron= ous .long FLT14,domain_crash_synchronous , FLT15,domain_crash_synchron= ous .long FLT16,domain_crash_synchronous , FLT17,domain_crash_synchron= ous - .long FLT18,domain_crash_synchronous , FLT19,domain_crash_synchron= ous - .long FLT20,domain_crash_synchronous , FLT21,domain_crash_synchron= ous .long FLT22,domain_crash_synchronous , FLT23,domain_crash_synchron= ous .long FLT24,domain_crash_synchronous , FLT25,domain_crash_synchron= ous .previous --PEIAKu/WMn1b1Hv9-- --FkmkrVfFsRoUs1wW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iEYEARECAAYFAkUB2YQACgkQnw66O/MvCNGuVACfdiyMylE7q/t2ZEIzpPb5G8wl suEAn2WYWHAzV9NPbracczY3pYTscCLP =d6FV -----END PGP SIGNATURE----- --FkmkrVfFsRoUs1wW-- --===============1302923258== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1302923258==--