]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
x86/boot: Drop all use of lmsw bootcleanup-andy
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 1 May 2019 17:14:03 +0000 (18:14 +0100)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Thu, 22 Aug 2019 11:05:52 +0000 (12:05 +0100)
lmsw is an obsolete relic of the 286 processor - so much so that it even lacks
intercept assistance on AMD processors.

Use a plain mov to %cr0 which is easier to follow, certainly faster to
virtualise on AMD hardware, and almost certainly a faster microcode path in
real hardware.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/boot/trampoline.S
xen/arch/x86/boot/wakeup.S

index 729a373573a21377e871d8b8fd47b8f50c48a9ee..61a1a025f0e4f87560d515fea7b5d383de64dff8 100644 (file)
@@ -102,9 +102,10 @@ GLOBAL(trampoline_realmode_entry)
         lidt    trampsym(idt_48)
         lgdtl   trampsym(gdt_48)
         mov     $1,%bl                    # EBX != 0 indicates we are an AP
-        xor     %ax, %ax
-        inc     %ax
-        lmsw    %ax                       # CR0.PE = 1 (enter protected mode)
+
+        mov     $X86_CR0_PE, %eax
+        mov     %eax, %cr0
+
         ljmpl   $BOOT_CS32,$tramp32sym_rel(trampoline_protmode_entry,6)
 
         .code32
@@ -312,9 +313,8 @@ trampoline_boot_cpu_entry:
         lgdtl   bootsym(boot16_gdt)
 
         /* Enter protected mode, and flush insn queue. */
-        xor     %ax,%ax
-        inc     %ax
-        lmsw    %ax                       # CR0.PE = 1 (enter protected mode)
+        mov     $X86_CR0_PE, %eax
+        mov     %eax, %cr0
 
         /* Load proper protected-mode values into all segment registers. */
         ljmpl   $BOOT_CS32,$bootsym_rel(1f,6)
index 35cf83b80e7753cfe498b06751bd7f560c9a3675..398b702a6b35d8988071fb588270b404b4ab5439 100644 (file)
@@ -51,8 +51,9 @@ ENTRY(wakeup_start)
         lidt    wakesym(idt_48)
         lgdt    wakesym(gdt_48)
 
-        movw    $1, %ax
-        lmsw    %ax             # Turn on CR0.PE 
+        mov     $X86_CR0_PE, %eax
+        mov     %eax, %cr0
+
         ljmpl   $BOOT_CS32, $trampsym_rel(wakeup_32, 6)
 
 /* This code uses an extended set of video mode numbers. These include: