x86: relocate_kernel - use predefined macroses for processor state
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
committed by
Ingo Molnar
parent
a7bba17bf0
commit
fd3af53122
@@ -9,6 +9,7 @@
|
|||||||
#include <linux/linkage.h>
|
#include <linux/linkage.h>
|
||||||
#include <asm/page.h>
|
#include <asm/page.h>
|
||||||
#include <asm/kexec.h>
|
#include <asm/kexec.h>
|
||||||
|
#include <asm/processor-flags.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Must be relocatable PIC code callable as a C function
|
* Must be relocatable PIC code callable as a C function
|
||||||
@@ -167,16 +168,16 @@ identity_mapped:
|
|||||||
pushl %edx
|
pushl %edx
|
||||||
|
|
||||||
/* Set cr0 to a known state:
|
/* Set cr0 to a known state:
|
||||||
* 31 0 == Paging disabled
|
* - Paging disabled
|
||||||
* 18 0 == Alignment check disabled
|
* - Alignment check disabled
|
||||||
* 16 0 == Write protect disabled
|
* - Write protect disabled
|
||||||
* 3 0 == No task switch
|
* - No task switch
|
||||||
* 2 0 == Don't do FP software emulation.
|
* - Don't do FP software emulation.
|
||||||
* 0 1 == Proctected mode enabled
|
* - Proctected mode enabled
|
||||||
*/
|
*/
|
||||||
movl %cr0, %eax
|
movl %cr0, %eax
|
||||||
andl $~((1<<31)|(1<<18)|(1<<16)|(1<<3)|(1<<2)), %eax
|
andl $~(X86_CR0_PG | X86_CR0_AM | X86_CR0_WP | X86_CR0_TS | X86_CR0_EM), %eax
|
||||||
orl $(1<<0), %eax
|
orl $(X86_CR0_PE), %eax
|
||||||
movl %eax, %cr0
|
movl %eax, %cr0
|
||||||
|
|
||||||
/* clear cr4 if applicable */
|
/* clear cr4 if applicable */
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
#include <linux/linkage.h>
|
#include <linux/linkage.h>
|
||||||
#include <asm/page.h>
|
#include <asm/page.h>
|
||||||
#include <asm/kexec.h>
|
#include <asm/kexec.h>
|
||||||
|
#include <asm/processor-flags.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Must be relocatable PIC code callable as a C function
|
* Must be relocatable PIC code callable as a C function
|
||||||
@@ -171,33 +172,22 @@ identity_mapped:
|
|||||||
pushq %rdx
|
pushq %rdx
|
||||||
|
|
||||||
/* Set cr0 to a known state:
|
/* Set cr0 to a known state:
|
||||||
* 31 1 == Paging enabled
|
* - Paging enabled
|
||||||
* 18 0 == Alignment check disabled
|
* - Alignment check disabled
|
||||||
* 16 0 == Write protect disabled
|
* - Write protect disabled
|
||||||
* 3 0 == No task switch
|
* - No task switch
|
||||||
* 2 0 == Don't do FP software emulation.
|
* - Don't do FP software emulation.
|
||||||
* 0 1 == Proctected mode enabled
|
* - Proctected mode enabled
|
||||||
*/
|
*/
|
||||||
movq %cr0, %rax
|
movq %cr0, %rax
|
||||||
andq $~((1<<18)|(1<<16)|(1<<3)|(1<<2)), %rax
|
andq $~(X86_CR0_AM | X86_CR0_WP | X86_CR0_TS | X86_CR0_EM), %rax
|
||||||
orl $((1<<31)|(1<<0)), %eax
|
orl $(X86_CR0_PG | X86_CR0_PE), %eax
|
||||||
movq %rax, %cr0
|
movq %rax, %cr0
|
||||||
|
|
||||||
/* Set cr4 to a known state:
|
/* Set cr4 to a known state:
|
||||||
* 10 0 == xmm exceptions disabled
|
* - physical address extension enabled
|
||||||
* 9 0 == xmm registers instructions disabled
|
|
||||||
* 8 0 == performance monitoring counter disabled
|
|
||||||
* 7 0 == page global disabled
|
|
||||||
* 6 0 == machine check exceptions disabled
|
|
||||||
* 5 1 == physical address extension enabled
|
|
||||||
* 4 0 == page size extensions disabled
|
|
||||||
* 3 0 == Debug extensions disabled
|
|
||||||
* 2 0 == Time stamp disable (disabled)
|
|
||||||
* 1 0 == Protected mode virtual interrupts disabled
|
|
||||||
* 0 0 == VME disabled
|
|
||||||
*/
|
*/
|
||||||
|
movq $X86_CR4_PAE, %rax
|
||||||
movq $((1<<5)), %rax
|
|
||||||
movq %rax, %cr4
|
movq %rax, %cr4
|
||||||
|
|
||||||
jmp 1f
|
jmp 1f
|
||||||
|
Reference in New Issue
Block a user