diff options
Diffstat (limited to 'arch/x86_64/boot/compressed/head.S')
-rw-r--r-- | arch/x86_64/boot/compressed/head.S | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/arch/x86_64/boot/compressed/head.S b/arch/x86_64/boot/compressed/head.S index c353a9266ea4..f9d5692a0106 100644 --- a/arch/x86_64/boot/compressed/head.S +++ b/arch/x86_64/boot/compressed/head.S | |||
@@ -54,6 +54,15 @@ startup_32: | |||
54 | 1: popl %ebp | 54 | 1: popl %ebp |
55 | subl $1b, %ebp | 55 | subl $1b, %ebp |
56 | 56 | ||
57 | /* setup a stack and make sure cpu supports long mode. */ | ||
58 | movl $user_stack_end, %eax | ||
59 | addl %ebp, %eax | ||
60 | movl %eax, %esp | ||
61 | |||
62 | call verify_cpu | ||
63 | testl %eax, %eax | ||
64 | jnz no_longmode | ||
65 | |||
57 | /* Compute the delta between where we were compiled to run at | 66 | /* Compute the delta between where we were compiled to run at |
58 | * and where the code will actually run at. | 67 | * and where the code will actually run at. |
59 | */ | 68 | */ |
@@ -159,13 +168,21 @@ startup_32: | |||
159 | /* Jump from 32bit compatibility mode into 64bit mode. */ | 168 | /* Jump from 32bit compatibility mode into 64bit mode. */ |
160 | lret | 169 | lret |
161 | 170 | ||
171 | no_longmode: | ||
172 | /* This isn't an x86-64 CPU so hang */ | ||
173 | 1: | ||
174 | hlt | ||
175 | jmp 1b | ||
176 | |||
177 | #include "../../kernel/verify_cpu.S" | ||
178 | |||
162 | /* Be careful here startup_64 needs to be at a predictable | 179 | /* Be careful here startup_64 needs to be at a predictable |
163 | * address so I can export it in an ELF header. Bootloaders | 180 | * address so I can export it in an ELF header. Bootloaders |
164 | * should look at the ELF header to find this address, as | 181 | * should look at the ELF header to find this address, as |
165 | * it may change in the future. | 182 | * it may change in the future. |
166 | */ | 183 | */ |
167 | .code64 | 184 | .code64 |
168 | .org 0x100 | 185 | .org 0x200 |
169 | ENTRY(startup_64) | 186 | ENTRY(startup_64) |
170 | /* We come here either from startup_32 or directly from a | 187 | /* We come here either from startup_32 or directly from a |
171 | * 64bit bootloader. If we come here from a bootloader we depend on | 188 | * 64bit bootloader. If we come here from a bootloader we depend on |