[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 2/2] x86/trampoline: load the GDT located in the trampoline page


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Tue, 2 May 2023 16:59:20 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Q9yYdD46obGJvl7PXXkeV3azaYqYy0EKOnWgIgsZyZ0=; b=MG2KD3oaXiAfG1K4iMnyoD8MJcMeZY15TE5U3dZew/1v/z5zGpgccgt3EoOqFyto4R/SAJgb+oSrlCtE0KkvnP47cfexyEu4Hf/LHv0ykFjWkvgtuoimbJAp76PpZGvoXCs4gm5JoSbdn078MVVmIRTKUxe0+X0EjR0n8fqvaarduzj41TCLzZMfQAW86bytPjdbXQ4Rhfe5kb5mALpWCA4y6KOQ/B3LEksERsi2+bgfBGuNsVJs7xhdcGi6afPZMn1GbnOBr/mEtlLIk+Wnge398XIWy4cOo/rtTYhxKT1Dqyxqh97wMOfjV1nNStFKAm+bBFkXRv3YQDhCvg+wWw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fke3hhsVQYoZkWY7of+dP26OVNizg8F/s6TN5197GLmFyyOFoFQmSscbqHRFDo0122+axJtV7QW6LG/Z17rANCQKeJz996yrbvf3j84nLlMGiMwDf268OKkCWpqzHb+XxszKOyji/456g1ldjikLtc+U3MVcFZpWK9ZajQcaVrSa0PEYMSXSFNparEQDpGSvsmmThY/DKCb1cSTecif/m1AgmS3Jm7GJWWzJi1y0f7/xSJFTMxepF7Kzkm3Xiq7LKUN6wX7SUDHW2Dy0S7eZfTtORUY1xA8i8Cb9bh2mrzPs/WJmsbGc3SVUwUzRr5Bd/VVCpEjh2jpORS3Wqfg49w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 02 May 2023 15:02:26 +0000
  • Ironport-data: A9a23:W51CSaNPUDEqF0jvrR2ElsFynXyQoLVcMsEvi/4bfWQNrUpw0GcOy WAbXDqFOf6DM2Lwc4p+b4iy909XuMTWy98wTwto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CU6jufQAOKnUoYoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGj9SuvPrRC9H5qyo42tF5gZmP5ingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0rspJXpwr 6dEET1XdVPfp+O0xu+aQ9A506zPLOGzVG8ekldJ6GiDSNMZG9XESaiM4sJE1jAtgMwIBezZe 8cSdTtoalLHfgFLPVAUTpk5mY9EhFGmK2Ee9A3T+/RxvzW7IA9ZidABNPLPfdOHX4NNl1uwr WPa5WXpRBodMbRzzBLcqi3917+Xw3uTtIQ6MeLnrtVK3gKozEdDCB8Jc3eVvsCLsxvrMz5YA wlOksY0loAi+UruQtTjUhmQpH+fogVaS9dWC/c96gyG1uzT+QnxLmoOQyNFadcmnNQrXjFs3 ViM9/v2ARR/vbvTTmiSnop4thu3MCkRaGodPykNSFJf58G5+N1uyBXSUtxkDai5yMXvHi39y CyLqy54gKgPickM1OOw+lWvby+Qm6UlhzUdvm3/Nl9JJCsgPNPNi1CAgbQD0ct9EQ==
  • Ironport-hdrordr: A9a23:/qMsLahr03lzSIjQigpdGdKEoXBQXu8ji2hC6mlwRA09TyVXrb HXoB17726OtN91YhsdcL+7Sc29qB/nhPtICMwqTNSftWrd2VdATrsSircKqgeIc0bDH6xmtZ uIFZIOauEYZmIK6/oSjjPIaurIA+PqzElrv4rjJrtWIj2CopsP0ztE
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

When booting the BSP the portion of the code executed from the
trampoline page will be using the GDT located in the hypervisor
.text.head section rather than the GDT located in the relocated
trampoline page.

If skip_realmode is not set the GDT located in the trampoline page
will be loaded after having executed the BIOS call, otherwise the GDT
from .text.head will be used for all the protected mode trampoline
code execution.

Note that both gdt_boot_descr and gdt_48 contain the same entries, but
the former is located inside the hypervisor .text section, while the
later lives in the relocated trampoline page.

This is not harmful as-is, as both GDTs contain the same entries, but
for consistency with the APs switch the BSP trampoline code to also
use the GDT on the relocated trampoline page.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
Changes since v1:
 - Reword comment.
---
 xen/arch/x86/boot/trampoline.S | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S
index cdecf949b410..c6005fa33d1f 100644
--- a/xen/arch/x86/boot/trampoline.S
+++ b/xen/arch/x86/boot/trampoline.S
@@ -164,6 +164,9 @@ GLOBAL(trampoline_cpu_started)
 
         .code32
 trampoline_boot_cpu_entry:
+        /* Switch to relocated trampoline GDT. */
+        lgdt    bootsym_rel(gdt_48, 4)
+
         cmpb    $0,bootsym_rel(skip_realmode,5)
         jnz     .Lskip_realmode
 
-- 
2.40.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.