From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Wei Liu" <wl@xen.org>, "Jan Beulich" <JBeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH v2 5/5] x86/boot: Drop sym_fs()
Date: Fri, 17 Jan 2020 20:42:23 +0000 [thread overview]
Message-ID: <20200117204223.30076-6-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20200117204223.30076-1-andrew.cooper3@citrix.com>
All remaining users of sym_fs() can trivially be switched to using sym_esi()
instead. This is shorter to encode and faster to execute.
This removes the final uses of %fs during boot, which allows us to drop
BOOT_FS from the trampoline GDT, which drops an 16M arbitrary limit on Xen's
compiled size.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
---
xen/arch/x86/boot/head.S | 41 ++++++++++++++---------------------------
xen/arch/x86/boot/trampoline.S | 1 -
2 files changed, 14 insertions(+), 28 deletions(-)
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 1acaf817ba..aea6744c80 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -14,14 +14,12 @@
#define sym_offs(sym) ((sym) - __XEN_VIRT_START)
#define sym_esi(sym) sym_offs(sym)(%esi)
-#define sym_fs(sym) %fs:sym_offs(sym)
#define BOOT_CS32 0x0008
#define BOOT_CS64 0x0010
#define BOOT_DS 0x0018
#define BOOT_PSEUDORM_CS 0x0020
#define BOOT_PSEUDORM_DS 0x0028
-#define BOOT_FS 0x0030
#define MB2_HT(name) (MULTIBOOT2_HEADER_TAG_##name)
#define MB2_TT(name) (MULTIBOOT2_TAG_TYPE_##name)
@@ -555,24 +553,13 @@ trampoline_bios_setup:
trampoline_setup:
/*
* Called on legacy BIOS and EFI platforms.
- *
- * Set the BOOT_FS descriptor base address to %esi.
*/
- 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)
- mov %esi,sym_fs(trampoline_xen_phys_start)
+ mov %esi, sym_esi(xen_phys_start)
+ mov %esi, sym_esi(trampoline_xen_phys_start)
- mov sym_fs(trampoline_phys),%ecx
+ mov sym_esi(trampoline_phys), %ecx
/* Get bottom-most low-memory stack address. */
add $TRAMPOLINE_SPACE,%ecx
@@ -583,13 +570,13 @@ trampoline_setup:
push %eax /* Magic number. */
call reloc
#ifdef CONFIG_PVH_GUEST
- cmpb $0, sym_fs(pvh_boot)
+ cmpb $0, sym_esi(pvh_boot)
je 1f
- mov %eax, sym_fs(pvh_start_info_pa)
+ mov %eax, sym_esi(pvh_start_info_pa)
jmp 2f
#endif
1:
- mov %eax, sym_fs(multiboot_ptr)
+ mov %eax, sym_esi(multiboot_ptr)
2:
/*
@@ -613,7 +600,7 @@ trampoline_setup:
* Do not zero BSS on EFI platform here.
* It was initialized earlier.
*/
- cmpb $0,sym_fs(efi_platform)
+ cmpb $0, sym_esi(efi_platform)
jnz 1f
/*
@@ -632,7 +619,7 @@ trampoline_setup:
/* Interrogate CPU extended features via CPUID. */
mov $1, %eax
cpuid
- mov %ecx, sym_fs(boot_cpu_data) + CPUINFO_FEATURE_OFFSET(X86_FEATURE_HYPERVISOR)
+ mov %ecx, CPUINFO_FEATURE_OFFSET(X86_FEATURE_HYPERVISOR) + sym_esi(boot_cpu_data)
mov $0x80000000,%eax
cpuid
@@ -644,7 +631,7 @@ trampoline_setup:
jbe 1f
mov $0x80000001,%eax
cpuid
-1: mov %edx, sym_fs(boot_cpu_data) + CPUINFO_FEATURE_OFFSET(X86_FEATURE_LM)
+1: mov %edx, CPUINFO_FEATURE_OFFSET(X86_FEATURE_LM) + sym_esi(boot_cpu_data)
/* Check for NX. Adjust EFER setting if available. */
bt $cpufeat_bit(X86_FEATURE_NX), %edx
@@ -658,8 +645,8 @@ trampoline_setup:
/* Stash TSC to calculate a good approximation of time-since-boot */
rdtsc
- mov %eax,sym_fs(boot_tsc_stamp)
- mov %edx,sym_fs(boot_tsc_stamp)+4
+ mov %eax, sym_esi(boot_tsc_stamp)
+ mov %edx, 4 + sym_esi(boot_tsc_stamp)
/* Relocate pagetables to point at Xen's current location in memory. */
mov $_PAGE_PRESENT, %edx
@@ -753,11 +740,11 @@ trampoline_setup:
jb 1b
/* Do not parse command line on EFI platform here. */
- cmpb $0,sym_fs(efi_platform)
+ cmpb $0, sym_esi(efi_platform)
jnz 1f
/* Bail if there is no command line to parse. */
- mov sym_fs(multiboot_ptr),%ebx
+ mov sym_esi(multiboot_ptr), %ebx
testl $MBI_CMDLINE,MB_flags(%ebx)
jz 1f
@@ -768,7 +755,7 @@ trampoline_setup:
1:
/* Switch to low-memory stack which lives at the end of trampoline region. */
- mov sym_fs(trampoline_phys),%edi
+ mov sym_esi(trampoline_phys), %edi
lea TRAMPOLINE_SPACE+TRAMPOLINE_STACK_SPACE(%edi),%esp
lea trampoline_boot_cpu_entry-trampoline_start(%edi),%eax
pushl $BOOT_CS32
diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S
index 6b403a6d1a..18c6638924 100644
--- a/xen/arch/x86/boot/trampoline.S
+++ b/xen/arch/x86/boot/trampoline.S
@@ -129,7 +129,6 @@ gdt_48:
.quad 0x00cf93000000ffff /* 0x0018: ring 0 data */
.quad 0x00009b000000ffff /* 0x0020: real-mode code @ BOOT_TRAMPOLINE */
.quad 0x000093000000ffff /* 0x0028: real-mode data @ BOOT_TRAMPOLINE */
- .quad 0x00c0930000000fff /* 0x0030: ring 0 Xen data, 16M @ XEN */
.Ltrampoline_gdt_end:
/* Relocations for trampoline Real Mode segments. */
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2020-01-17 20:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-17 20:42 [Xen-devel] [PATCH v2 0/5] x86: Remove more 16M total-size restrictions Andrew Cooper
2020-01-17 20:42 ` [Xen-devel] [PATCH v2 1/5] x86/boot: Create the l2_xenmap[] mappings dynamically Andrew Cooper
2020-01-20 10:29 ` Jan Beulich
2020-01-17 20:42 ` [Xen-devel] [PATCH v2 2/5] x86/boot: Size the boot/directmap " Andrew Cooper
2020-01-20 10:30 ` Jan Beulich
2020-01-17 20:42 ` [Xen-devel] [PATCH v2 3/5] x86/boot: Drop explicit %fs uses Andrew Cooper
2020-01-20 10:35 ` Jan Beulich
2020-01-17 20:42 ` [Xen-devel] [PATCH v2 4/5] x86/boot: Simplify pagetable manipulation loops Andrew Cooper
2020-01-20 10:46 ` Jan Beulich
2020-01-22 15:43 ` Andrew Cooper
2020-01-17 20:42 ` Andrew Cooper [this message]
2020-01-20 11:39 ` [Xen-devel] [PATCH v2 5/5] x86/boot: Drop sym_fs() Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200117204223.30076-6-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.