diff options
author | Jarkko Sakkinen <jarkko.sakkinen@intel.com> | 2012-05-08 14:22:46 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2012-05-08 18:04:27 -0400 |
commit | cda846f101fb1396b6924f1d9b68ac3d42de5403 (patch) | |
tree | 1fa8716c308b8e10156a1caf51d8ff6c98eceea9 /arch/x86/kernel | |
parent | bf8b88e97716feb750c3d34492f00d9c085e1183 (diff) |
x86, realmode: read cr4 and EFER from kernel for 64-bit trampoline
This patch changes 64-bit trampoline so that CR4 and
EFER are provided by the kernel instead of using fixed
values.
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@intel.com>
Link: http://lkml.kernel.org/r/1336501366-28617-24-git-send-email-jarkko.sakkinen@intel.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/realmode.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/setup.c | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/arch/x86/kernel/realmode.c b/arch/x86/kernel/realmode.c index 712fba8fd774..66ac276cf361 100644 --- a/arch/x86/kernel/realmode.c +++ b/arch/x86/kernel/realmode.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <asm/realmode.h> | 6 | #include <asm/realmode.h> |
7 | 7 | ||
8 | struct real_mode_header *real_mode_header; | 8 | struct real_mode_header *real_mode_header; |
9 | u32 *trampoline_cr4_features; | ||
9 | 10 | ||
10 | void __init setup_real_mode(void) | 11 | void __init setup_real_mode(void) |
11 | { | 12 | { |
@@ -64,7 +65,14 @@ void __init setup_real_mode(void) | |||
64 | trampoline_header->gdt_limit = __BOOT_DS + 7; | 65 | trampoline_header->gdt_limit = __BOOT_DS + 7; |
65 | trampoline_header->gdt_base = __pa(boot_gdt); | 66 | trampoline_header->gdt_base = __pa(boot_gdt); |
66 | #else | 67 | #else |
68 | if (rdmsr_safe(MSR_EFER, &trampoline_header->efer_low, | ||
69 | &trampoline_header->efer_high)) | ||
70 | BUG(); | ||
71 | |||
67 | trampoline_header->start = (u64) secondary_startup_64; | 72 | trampoline_header->start = (u64) secondary_startup_64; |
73 | trampoline_cr4_features = &trampoline_header->cr4; | ||
74 | *trampoline_cr4_features = read_cr4(); | ||
75 | |||
68 | trampoline_pgd = (u64 *) __va(real_mode_header->trampoline_pgd); | 76 | trampoline_pgd = (u64 *) __va(real_mode_header->trampoline_pgd); |
69 | trampoline_pgd[0] = __pa(level3_ident_pgt) + _KERNPG_TABLE; | 77 | trampoline_pgd[0] = __pa(level3_ident_pgt) + _KERNPG_TABLE; |
70 | trampoline_pgd[511] = __pa(level3_kernel_pgt) + _KERNPG_TABLE; | 78 | trampoline_pgd[511] = __pa(level3_kernel_pgt) + _KERNPG_TABLE; |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 7a14fece9cfc..efcf305210a4 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -975,6 +975,8 @@ void __init setup_arch(char **cmdline_p) | |||
975 | if (boot_cpu_data.cpuid_level >= 0) { | 975 | if (boot_cpu_data.cpuid_level >= 0) { |
976 | /* A CPU has %cr4 if and only if it has CPUID */ | 976 | /* A CPU has %cr4 if and only if it has CPUID */ |
977 | mmu_cr4_features = read_cr4(); | 977 | mmu_cr4_features = read_cr4(); |
978 | if (trampoline_cr4_features) | ||
979 | *trampoline_cr4_features = mmu_cr4_features; | ||
978 | } | 980 | } |
979 | 981 | ||
980 | #ifdef CONFIG_X86_32 | 982 | #ifdef CONFIG_X86_32 |