]> xenbits.xensource.com Git - people/hx242/xen.git/commitdiff
x86/boot: Drop all use of lmsw
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 1 May 2019 17:14:03 +0000 (18:14 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 28 Aug 2019 18:52:54 +0000 (19:52 +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>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/boot/trampoline.S
xen/arch/x86/boot/wakeup.S

index e98db7e3ccb29f72fa392d018bc56a8b8f1e29dc..8dd48ece94e74677cf40bf1fe377493fb124c42a 100644 (file)
@@ -53,10 +53,9 @@ GLOBAL(trampoline_realmode_entry)
         cli
         lidt    bootsym(idt_48)
         lgdt    bootsym(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, %ebx         # EBX != 0 indicates we are an AP
+        mov     %ebx, %cr0                # Alias with CR0.PE for brevity
+
         ljmpl   $BOOT_CS32,$bootsym_rel(trampoline_protmode_entry,6)
 
 trampoline_gdt:
@@ -263,9 +262,8 @@ trampoline_boot_cpu_entry:
         lgdt    bootsym(gdt_48)
 
         /* 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 090487ba783ca70e0eaa195a73cccdc8febc772d..6dbb1bc0eb16c26603fd0d1a4d133940efdb00f9 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, $bootsym_rel(wakeup_32, 6)
 
 /* This code uses an extended set of video mode numbers. These include: