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

[xen master] x86/trampoline: load the GDT located in the trampoline page



commit eaa324bfebcf17333d993b74024901701e0e2162
Author:     Roger Pau Monné <roger.pau@xxxxxxxxxx>
AuthorDate: Wed May 3 13:37:19 2023 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed May 3 13:37:19 2023 +0200

    x86/trampoline: load the GDT located in the trampoline page
    
    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>
---
 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 cdecf949b4..c6005fa33d 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
 
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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