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

[Xen-changelog] [xen staging] x86/boot: Simplify %fs setup in trampoline_setup



commit c463d0d5ab6ede90efe914f3bfce4f1de3a25a75
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu Aug 8 17:18:10 2019 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Aug 14 12:04:20 2019 +0100

    x86/boot: Simplify %fs setup in trampoline_setup
    
    mov/shr is easier to follow than shld, and doesn't have a merge dependency 
on
    the previous value of %edx.  Shorten the rest of the code by streamlining 
the
    comments.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Wei Liu <wl@xxxxxxx>
---
 xen/arch/x86/boot/head.S | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 782deac0d4..26b680521d 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -556,24 +556,17 @@ trampoline_setup:
         /*
          * Called on legacy BIOS and EFI platforms.
          *
-         * Initialize bits 0-15 of BOOT_FS segment descriptor base address.
+         * Set the BOOT_FS descriptor base address to %esi.
          */
-        mov     %si,BOOT_FS+2+sym_esi(trampoline_gdt)
-
-        /* Initialize bits 16-23 of BOOT_FS segment descriptor base address. */
-        shld    $16,%esi,%edx
-        mov     %dl,BOOT_FS+4+sym_esi(trampoline_gdt)
-
-        /* Initialize bits 24-31 of BOOT_FS segment descriptor base address. */
-        mov     %dh,BOOT_FS+7+sym_esi(trampoline_gdt)
-
-        /*
-         * Initialize %fs and later use it to access Xen data where possible.
-         * According to Intel 64 and IA-32 Architectures Software Developer's
-         * Manual it is safe to do that without reloading GDTR before.
-         */
-        mov     $BOOT_FS,%edx
-        mov     %edx,%fs
+        mov     %esi, %edx
+        shr     $16, %edx
+        mov     %si, BOOT_FS + 2 + sym_esi(trampoline_gdt) /* Bits  0-15 */
+        mov     %dl, BOOT_FS + 4 + sym_esi(trampoline_gdt) /* Bits 16-23 */
+        mov     %dh, BOOT_FS + 7 + sym_esi(trampoline_gdt) /* Bits 24-31 */
+
+        /* Load %fs to allow for access to Xen data. */
+        mov     $BOOT_FS, %edx
+        mov     %edx, %fs
 
         /* Save Xen image load base address for later use. */
         mov     %esi,sym_fs(xen_phys_start)
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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