[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 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 11:22:24 +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=TUjBzIIMR2wZs7nCQYlISDZS3wMRy1R7AX1/v57R7+w=; b=LK2zt9zsprfon7bdwxRH7KUx8gVbcoWguVDkDaotou/nzoySMbLoxJRTCrOI41ZVa/KMF9Q150kke9mdXtxumiWHRy9+l8H3o8wUHf8rWdNQEmFDX3HH7L++91woP9RUzXLb819R0jRP2l2WuAiocN/QFshDDDt9l8FNkh5efaYs5IEXaOzGhqRyj6FbII2VKThJ0SansSxoViX4MJpuEkeowTmothcACIoqlNheh05sJjfKDph9TJLx81YWmrQ6wK2LTKMOdpMAH8qjO4QJWy27kFLD3JtiaT83zJsUpa2pQpU81AMuWzm9ew7tOEzAaJI3WkToioija65aPTSBCw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fyKmkPZc0R2sVFoAByrKZWef/NHL6WziTmFrL/7Uh6BcznhYMwwhrQwMGpXmHgumSCyeV1K2RB+1AGRO9wP3+tgQ+gqRO0VJV8ZOLwT7kCRakQfA/7VJ3Nw9rvwFdd429o8qj/OPtNQo3QC+x9q07ulQHK9Z/PYUp9s5L7JS4ZTz93HaGrEwGzT9lE9S9VDrEPmJy325IzRjU3KVsM9/5lryUbG6w4X06EWTFtm4+UDVWaOYGmDfkmJHaQL4ic0VUlwDQCyCUmKBcYcGjHXFKeEAPDl53ijinV2ja8VK/kbTFMelrp84IuESTWrHe72dxEY7lnk9IgXna8DjLQd9sw==
- 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 09:23:01 +0000
- Ironport-data: A9a23:f7vg4Kx9xmwsU1jbvkF6t+cRxyrEfRIJ4+MujC+fZmUNrF6WrkUCy WQXXTuOO/rbYGr9L4wnO43j8k4DsJWHndZgHVBpqyAxQypGp/SeCIXCJC8cHc8wwu7rFxs7s ppEOrEsCOhuExcwcz/0auCJQUFUjP3OHfykTrafYEidfCc8IA85kxVvhuUltYBhhNm9Emult Mj75sbSIzdJ4RYtWo4vw//F+UIHUMja4mtC5QRjPaoT5TcyqlFOZH4hDfDpR5fHatE88t6SH 47r0Ly/92XFyBYhYvvNfmHTKxBirhb6ZGBiu1IOM0SQqkEqSh8ai87XAME0e0ZP4whlqvgqo Dl7WT5cfi9yVkHEsLx1vxC1iEiSN4UekFPMCSDXXcB+UyQq2pYjqhljJBheAGEWxgp4KVB8x aY8BAoRVDPd2uW6+ZKAFthvj+12eaEHPKtH0p1h5RfwKK98BLzmHeDN79Ie2yosjMdTG/qYf 9AedTdkcBXHZVtIJ0sTD5U92uyvgxETcRUB8A7T+fVxvjmVlVMuuFTuGIO9ltiiX8Jak1zev mvb12/4HgsbJJqUzj/tHneE37eQwH2kBN9OfFG+3sRMjWCT7VcYMyYtUUrliteor2iQC90Kf iT4/QJr98De7neDXtT7GhG1vnOAlhodQMZLVf037hmXzajZ6BrfAXILJhZDYtE7sM49RRQxy 0SE2djuAFRHr7m9WX+bsLCOoluP1TM9KGYDYWoISFUD6ty6+oUr1EuQEZBkDbK/icDzFXfo2 TeWoSMihrIVy8kWy6G8+lOBiDWpznTUcjMICszsdjrNxmtEiESNPeRENXCzAS58Ebuk
- Ironport-hdrordr: A9a23:NkiOOa9R0ApEaksDvItuk+FZdb1zdoMgy1knxilNoENuH/Bwxv rFoB1E73TJYW4qKQodcdDpAtjifZquz+8O3WBxB8boYOCCggeVxe5ZnOzfKlHbehEWs9QtrZ uIEJIOQuEYb2IK6/oSiTPQe7lP/DDEytHQuQ609QYOcegeUdAF0+4PMHf/LqQZfml7LKt8MK DZyttMpjKmd3hSRN+8HGM5U+/KoMCOvI76YDYdbiRXpDWmvHeN0vrXAhKY1hARX3dk2rE561 XIlAT/++GKr+y78BnBzGXehq4m1+cJi+EzSvBkuPJlagkEuTzYJ7iJnIfy/gzdldvfqWrCVu O85ivIcf4Dr085NVvF3CcFkzOQrArGrUWShGNwyEGT3/AQSF8BerV8rJMcfR3D50U6utZglK pNwmKCrpJSSQjNhSLn+rHzJmdXf2eP0A4feNQo/gtieJpbbKUUoZ0U/UtTHptFFCXm6Jo/GO 0rCM3H/v5ZfV6Tcnic5wBUsZSRd2V2Gg3DTlkJu8ST3TQTlHdlz1EAzMhamnsb7poyR5RN+u yBOKV1k7NFSNMQcMtGda48aNryDnaITQPHMWqUL1iiHKYbO2jVo5qy+7kx7PHCQu188HLzou WybLp1jx9AR6u1M7z+4HRiyGG8fFmA
- 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 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 trampoline page.
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
xen/arch/x86/boot/trampoline.S | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S
index cdecf949b410..e4b4b9091d0c 100644
--- a/xen/arch/x86/boot/trampoline.S
+++ b/xen/arch/x86/boot/trampoline.S
@@ -164,6 +164,12 @@ GLOBAL(trampoline_cpu_started)
.code32
trampoline_boot_cpu_entry:
+ /*
+ * Load the GDT from the relocated trampoline page rather than the
+ * hypervisor .text section.
+ */
+ lgdt bootsym_rel(gdt_48, 4)
+
cmpb $0,bootsym_rel(skip_realmode,5)
jnz .Lskip_realmode
--
2.40.0
|