From 9a5269f6137bbc73d55d0ba8e43e90bb71680bc9 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 28 Apr 2019 17:13:37 +0300 Subject: [PATCH] x86/wakeup: Stop using %fs for lidt/lgdt The wakeup code is now relocated alongside the trampoline code, so as long as we move idt_48 and gdt_48 up a little bit so that they're visible in the real-mode segment that the wakeup code runs in, using %ds is just fine here. Signed-off-by: David Woodhouse Acked-by: Andrew Cooper --- xen/arch/x86/boot/trampoline.S | 14 +++++++------- xen/arch/x86/boot/wakeup.S | 11 ++--------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S index 5588c7986a..125bdb5a58 100644 --- a/xen/arch/x86/boot/trampoline.S +++ b/xen/arch/x86/boot/trampoline.S @@ -52,13 +52,6 @@ GLOBAL(trampoline_realmode_entry) lmsw %ax # CR0.PE = 1 (enter protected mode) ljmpl $BOOT_CS32,$bootsym_rel(trampoline_protmode_entry,6) - .balign 8 - .word 0 -idt_48: .word 0, 0, 0 # base = limit = 0 - .word 0 -gdt_48: .word 6*8-1 - .long bootsym_rel(trampoline_gdt,4) - trampoline_gdt: /* 0x0000: unused */ .quad 0x0000000000000000 @@ -178,6 +171,13 @@ start64: #include "wakeup.S" + .balign 8 + .word 0 +idt_48: .word 0, 0, 0 # base = limit = 0 + .word 0 +gdt_48: .word 6*8-1 + .long bootsym_rel(trampoline_gdt,4) + /* The first page of trampoline is permanent, the rest boot-time only. */ /* Reuse the boot trampoline on the 1st trampoline page as stack for wakeup. */ .equ wakeup_stack, trampoline_start + PAGE_SIZE diff --git a/xen/arch/x86/boot/wakeup.S b/xen/arch/x86/boot/wakeup.S index f9632eef95..89df2617ae 100644 --- a/xen/arch/x86/boot/wakeup.S +++ b/xen/arch/x86/boot/wakeup.S @@ -40,11 +40,8 @@ ENTRY(wakeup_start) movw %ax, %fs movw $0x0e00 + 'L', %fs:(0x10) - # boot trampoline is under 1M, and shift its start into - # %fs to reference symbols in that area - mov wakesym(trampoline_seg), %fs - lidt %fs:bootsym(idt_48) - lgdt %fs:bootsym(gdt_48) + lidt wakesym(idt_48) + lgdt wakesym(gdt_48) movw $1, %ax lmsw %ax # Turn on CR0.PE @@ -102,10 +99,6 @@ GLOBAL(video_mode) .long 0 GLOBAL(video_flags) .long 0 -trampoline_seg: .word 0 - .pushsection .trampoline_seg, "a" - .long trampoline_seg - . - .popsection .code32 -- 2.39.5