Commit 0a1e8869 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Ingo Molnar

x86: trampoline_64.S - use predefined constants with simplification

Impact: cleanup

We may use macros from processor-flags.h instead
of hardcoding bits. Actually it's not direct mapping
of old instructions with new ones -- BTS does change
CF flag while MOV does not. But i didn't find any
dependency on CF in this code.
Signed-off-by: default avatarCyrill Gorcunov <gorcunov@openvz.org>
Acked-by: default avatarAlexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 2d4d57db
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <asm/page.h> #include <asm/page.h>
#include <asm/msr.h> #include <asm/msr.h>
#include <asm/segment.h> #include <asm/segment.h>
#include <asm/processor-flags.h>
.section .rodata, "a", @progbits .section .rodata, "a", @progbits
...@@ -37,7 +38,7 @@ ...@@ -37,7 +38,7 @@
ENTRY(trampoline_data) ENTRY(trampoline_data)
r_base = . r_base = .
cli # We should be safe anyway cli # We should be safe anyway
wbinvd wbinvd
mov %cs, %ax # Code and data in the same place mov %cs, %ax # Code and data in the same place
mov %ax, %ds mov %ax, %ds
mov %ax, %es mov %ax, %es
...@@ -73,9 +74,8 @@ r_base = . ...@@ -73,9 +74,8 @@ r_base = .
lidtl tidt - r_base # load idt with 0, 0 lidtl tidt - r_base # load idt with 0, 0
lgdtl tgdt - r_base # load gdt with whatever is appropriate lgdtl tgdt - r_base # load gdt with whatever is appropriate
xor %ax, %ax mov $X86_CR0_PE, %ax # protected mode (PE) bit
inc %ax # protected mode (PE) bit lmsw %ax # into protected mode
lmsw %ax # into protected mode
# flush prefetch and jump to startup_32 # flush prefetch and jump to startup_32
ljmpl *(startup_32_vector - r_base) ljmpl *(startup_32_vector - r_base)
...@@ -86,9 +86,8 @@ startup_32: ...@@ -86,9 +86,8 @@ startup_32:
movl $__KERNEL_DS, %eax # Initialize the %ds segment register movl $__KERNEL_DS, %eax # Initialize the %ds segment register
movl %eax, %ds movl %eax, %ds
xorl %eax, %eax movl $X86_CR4_PAE, %eax
btsl $5, %eax # Enable PAE mode movl %eax, %cr4 # Enable PAE mode
movl %eax, %cr4
# Setup trampoline 4 level pagetables # Setup trampoline 4 level pagetables
leal (trampoline_level4_pgt - r_base)(%esi), %eax leal (trampoline_level4_pgt - r_base)(%esi), %eax
...@@ -99,9 +98,9 @@ startup_32: ...@@ -99,9 +98,9 @@ startup_32:
xorl %edx, %edx xorl %edx, %edx
wrmsr wrmsr
xorl %eax, %eax # Enable paging and in turn activate Long Mode
btsl $31, %eax # Enable paging and in turn activate Long Mode # Enable protected mode
btsl $0, %eax # Enable protected mode movl $(X86_CR0_PG | X86_CR0_PE), %eax
movl %eax, %cr0 movl %eax, %cr0
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment