]>
Commit | Line | Data |
---|---|---|
3c0a051f | 1 | #------------------------------------------------------------------------------\r |
2 | #\r | |
3 | # Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r | |
4 | #\r | |
5 | # This program and the accompanying materials\r | |
6 | # are licensed and made available under the terms and conditions of the BSD License\r | |
7 | # which accompanies this distribution. The full text of the license may be found at\r | |
8 | # http://opensource.org/licenses/bsd-license.php.\r | |
9 | #\r | |
10 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | #\r | |
13 | #------------------------------------------------------------------------------\r | |
14 | \r | |
15 | ASM_GLOBAL ASM_PFX(JumpToKernel)\r | |
16 | \r | |
17 | #------------------------------------------------------------------------------\r | |
18 | # VOID\r | |
19 | # EFIAPI\r | |
20 | # JumpToKernel (\r | |
21 | # VOID *KernelStart, // %rcx\r | |
22 | # VOID *KernelBootParams // %rdx\r | |
23 | # );\r | |
24 | #------------------------------------------------------------------------------\r | |
25 | ASM_PFX(JumpToKernel):\r | |
61a114ba | 26 | \r |
27 | // Set up for executing kernel. BP in %esi, entry point on the stack\r | |
28 | // (64-bit when the 'ret' will use it as 32-bit, but we're little-endian)\r | |
3c0a051f | 29 | movq %rdx, %rsi\r |
61a114ba | 30 | pushq %rcx\r |
31 | \r | |
32 | // Jump into the compatibility mode CS\r | |
33 | pushq $0x10\r | |
34 | leaq 1f, %rax\r | |
35 | pushq %rax\r | |
36 | retfq\r | |
37 | \r | |
38 | 1: // Now in compatibility mode\r | |
39 | .code32\r | |
40 | movl $0x18, %eax\r | |
41 | movl %eax, %ds\r | |
42 | movl %eax, %es\r | |
43 | movl %eax, %fs\r | |
44 | movl %eax, %gs\r | |
45 | movl %eax, %ss\r | |
46 | \r | |
47 | // Disable paging\r | |
48 | movl %cr0, %eax\r | |
49 | btcl $31, %eax\r | |
50 | movl %eax, %cr0\r | |
51 | \r | |
52 | // Disable long mode in EFER\r | |
53 | movl $0x0c0000080, %ecx\r | |
54 | rdmsr\r | |
55 | btcl $8, %eax\r | |
56 | wrmsr\r | |
57 | \r | |
58 | // Disable PAE\r | |
59 | movl %cr4, %eax\r | |
60 | btcl $5, %eax\r | |
61 | movl %eax, %cr4\r | |
62 | \r | |
63 | // Zero registers and 'return' to kernel\r | |
64 | xorl %ebp, %ebp\r | |
65 | xorl %edi, %edi\r | |
66 | xorl %ebx, %ebx\r | |
3c0a051f | 67 | ret\r |
61a114ba | 68 | .code64\r |
3c0a051f | 69 | \r |