diff options
author | Vivek Goyal <vgoyal@in.ibm.com> | 2007-05-02 13:27:08 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2007-05-02 13:27:08 -0400 |
commit | a4831e08b7f3ed51623c9eb25e8c945b76b3eda3 (patch) | |
tree | cc38c9df02560fba778dfbff5f389e4ac3b720b9 /arch/x86_64/kernel/acpi | |
parent | 8035d3ea78c2a61a9738c7857742370e0aa74d5c (diff) |
[PATCH] x86-64: Move cpu verification code to common file
o This patch moves the code to verify long mode and SSE to a common file.
This code is now shared by trampoline.S, wakeup.S, boot/setup.S and
boot/compressed/head.S
o So far we used to do very limited check in trampoline.S, wakeup.S and
in 32bit entry point. Now all the entry paths are forced to do the
exhaustive check, including SSE because verify_cpu is shared.
o I am keeping this patch as last in the x86 relocatable series because
previous patches have got quite some amount of testing done and don't want
to distrub that. So that if there is problem introduced by this patch, at
least it can be easily isolated.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/x86_64/kernel/acpi')
-rw-r--r-- | arch/x86_64/kernel/acpi/wakeup.S | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/arch/x86_64/kernel/acpi/wakeup.S b/arch/x86_64/kernel/acpi/wakeup.S index 766cfbcac1db..8550a6ffa275 100644 --- a/arch/x86_64/kernel/acpi/wakeup.S +++ b/arch/x86_64/kernel/acpi/wakeup.S | |||
@@ -43,6 +43,11 @@ wakeup_code: | |||
43 | cmpl $0x12345678, %eax | 43 | cmpl $0x12345678, %eax |
44 | jne bogus_real_magic | 44 | jne bogus_real_magic |
45 | 45 | ||
46 | call verify_cpu # Verify the cpu supports long | ||
47 | # mode | ||
48 | testl %eax, %eax | ||
49 | jnz no_longmode | ||
50 | |||
46 | testl $1, video_flags - wakeup_code | 51 | testl $1, video_flags - wakeup_code |
47 | jz 1f | 52 | jz 1f |
48 | lcall $0xc000,$3 | 53 | lcall $0xc000,$3 |
@@ -92,18 +97,6 @@ wakeup_32: | |||
92 | # Running in this code, but at low address; paging is not yet turned on. | 97 | # Running in this code, but at low address; paging is not yet turned on. |
93 | movb $0xa5, %al ; outb %al, $0x80 | 98 | movb $0xa5, %al ; outb %al, $0x80 |
94 | 99 | ||
95 | /* Check if extended functions are implemented */ | ||
96 | movl $0x80000000, %eax | ||
97 | cpuid | ||
98 | cmpl $0x80000000, %eax | ||
99 | jbe bogus_cpu | ||
100 | wbinvd | ||
101 | mov $0x80000001, %eax | ||
102 | cpuid | ||
103 | btl $29, %edx | ||
104 | jnc bogus_cpu | ||
105 | movl %edx,%edi | ||
106 | |||
107 | movl $__KERNEL_DS, %eax | 100 | movl $__KERNEL_DS, %eax |
108 | movl %eax, %ds | 101 | movl %eax, %ds |
109 | 102 | ||
@@ -123,6 +116,11 @@ wakeup_32: | |||
123 | leal (wakeup_level4_pgt - wakeup_code)(%esi), %eax | 116 | leal (wakeup_level4_pgt - wakeup_code)(%esi), %eax |
124 | movl %eax, %cr3 | 117 | movl %eax, %cr3 |
125 | 118 | ||
119 | /* Check if nx is implemented */ | ||
120 | movl $0x80000001, %eax | ||
121 | cpuid | ||
122 | movl %edx,%edi | ||
123 | |||
126 | /* Enable Long Mode */ | 124 | /* Enable Long Mode */ |
127 | xorl %eax, %eax | 125 | xorl %eax, %eax |
128 | btsl $_EFER_LME, %eax | 126 | btsl $_EFER_LME, %eax |
@@ -244,10 +242,12 @@ bogus_64_magic: | |||
244 | movb $0xb3,%al ; outb %al,$0x80 | 242 | movb $0xb3,%al ; outb %al,$0x80 |
245 | jmp bogus_64_magic | 243 | jmp bogus_64_magic |
246 | 244 | ||
247 | bogus_cpu: | 245 | .code16 |
248 | movb $0xbc,%al ; outb %al,$0x80 | 246 | no_longmode: |
249 | jmp bogus_cpu | 247 | movb $0xbc,%al ; outb %al,$0x80 |
248 | jmp no_longmode | ||
250 | 249 | ||
250 | #include "../verify_cpu.S" | ||
251 | 251 | ||
252 | /* This code uses an extended set of video mode numbers. These include: | 252 | /* This code uses an extended set of video mode numbers. These include: |
253 | * Aliases for standard modes | 253 | * Aliases for standard modes |