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

[PATCH 06/11] x86/boot: Use stack to remove a relocation from trampoline code



The destination selector is computed from a GDT entry.
The stack is setup anyway to allow calling real mode interrupts.

Signed-off-by: Frediano Ziglio <freddy77@xxxxxxxxx>
---
 xen/arch/x86/boot/trampoline.S | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S
index c52c27795d..faa5bb9e30 100644
--- a/xen/arch/x86/boot/trampoline.S
+++ b/xen/arch/x86/boot/trampoline.S
@@ -27,13 +27,6 @@
         .long 111b - (off) - .;            \
         .popsection
 
-#define bootsym_segrel(sym, off)           \
-        $0,$bootsym(sym);                  \
-111:;                                      \
-        .pushsection .trampoline_seg, "a"; \
-        .long 111b - (off) - .;            \
-        .popsection
-
 /* Start of the permanent trampoline code. */
 
         .code16
@@ -210,6 +203,9 @@ trampoline_boot_cpu_entry:
         mov     %eax,%gs
         mov     %eax,%ss
 
+        /* Initialise stack pointer. */
+        xor     %esp, %esp
+
         /* Switch to pseudo-rm CS, enter real mode, and flush insn queue. */
         mov     %cr0,%eax
         dec     %eax
@@ -218,14 +214,16 @@ trampoline_boot_cpu_entry:
 1:      mov     %eax,%cr0                 # CR0.PE = 0 (leave protected mode)
 
         /* Load proper real-mode values into %cs, %ds, %es and %ss. */
-        ljmp    bootsym_segrel(1f,2)
-1:      mov     %cs,%ax
-        mov     %ax,%ds
+        mov     bootsym(trampoline_gdt)+BOOT_PSEUDORM_DS+3, %ax
+        shl     $4, %ax
+        pushw   %ax
+        pushw   $bootsym(1f)
+        lretw
+1:      mov     %ax,%ds
         mov     %ax,%es
         mov     %ax,%ss
 
-        /* Initialise stack pointer and IDT, and enable irqs. */
-        xor     %esp,%esp
+        /* Initialise IDT, and enable irqs. */
         lidt    bootsym(rm_idt)
         sti
 
-- 
2.43.0




 


Rackspace

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