From: Steven Smith Subject: Fix checked builds of Windows on AMD processors Date: Tue, 11 Aug 2009 16:00:51 +0100 Message-ID: <20090811150051.GA27264@weybridge.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0123008094==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============0123008094== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="24zk1gE8NUlDmwG9" Content-Disposition: inline --24zk1gE8NUlDmwG9 Content-Type: multipart/mixed; boundary="h31gzZEtNLTqOjlF" Content-Disposition: inline --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Checked builds of Windows (2003 at least; I haven't tried anything else) don't currently work on Xen running on AMD processors, because they assert that the task priority sub-class in the TPR is correctly preserved, and Xen doesn't do that. The attached patch makes it do so. This was enough to make a checked build boot on my test box, but hasn't had any more testing beyond that. Applies cleanly to 20048:e35a1c004fc2 of xen-unstable.hg. Steven. --h31gzZEtNLTqOjlF Content-Type: text/x-diff; charset=us-ascii Content-Disposition: inline; filename="fix-windows-checked-build.diff" Content-Transfer-Encoding: quoted-printable Checked builds of Windows will, after every modification of the TPR, read it back again and assert that the value read back matches with the value written, including the priority sub-class. Make sure that we correctly preserve it on vmexit. As far as I can tell from reading the documentation, the sub-class doesn't actually do anything, so this should be pretty harmless. Signed-off-by: Steven Smith diff -r e35a1c004fc2 xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Tue Aug 11 07:36:26 2009 +0100 +++ b/xen/arch/x86/hvm/svm/svm.c Tue Aug 11 15:45:14 2009 +0100 @@ -1307,8 +1307,12 @@ asmlinkage void svm_vmexit_handler(struc * SVM's vTPR. It's OK if the guest doesn't touch CR8 (e.g. 32-bit Win= dows) * because we update the vTPR on MMIO writes to the TPR. */ + /* Careful: you need to preserve the low bits of the TPR in order + * to make checked builds of Windows work, even though they don't + * actually do anything. */ vlapic_set_reg(vcpu_vlapic(v), APIC_TASKPRI, - (vmcb->vintr.fields.tpr & 0x0F) << 4); + ((vmcb->vintr.fields.tpr & 0x0F) << 4) | + (vlapic_get_reg(APIC_TASKPRI) & 0x0F)); =20 exit_reason =3D vmcb->exitcode; =20 --h31gzZEtNLTqOjlF-- --24zk1gE8NUlDmwG9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFKgYejvAgSWYI3DVMRAvgSAKDLpD/bjv9fRfo/o4tmZBUq5VNo4gCfY9jP TeX06+TKsqK+/232g9O/374= =fEQL -----END PGP SIGNATURE----- --24zk1gE8NUlDmwG9-- --===============0123008094== 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 --===============0123008094==--