]>
Commit | Line | Data |
---|---|---|
f1baef62 | 1 | ;------------------------------------------------------------------------------\r |
2 | ;\r | |
3 | ; Copyright (c) 2006, Intel Corporation\r | |
4 | ; All rights reserved. This program and the accompanying materials\r | |
5 | ; are licensed and made available under the terms and conditions of the BSD License\r | |
6 | ; which accompanies this distribution. The full text of the license may be found at\r | |
7 | ; http://opensource.org/licenses/bsd-license.php\r | |
8 | ;\r | |
9 | ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | ;\r | |
12 | ; Module Name:\r | |
13 | ;\r | |
14 | ; EnablePaging64.Asm\r | |
15 | ;\r | |
16 | ; Abstract:\r | |
17 | ;\r | |
18 | ; AsmEnablePaging64 function\r | |
19 | ;\r | |
20 | ; Notes:\r | |
21 | ;\r | |
22 | ;------------------------------------------------------------------------------\r | |
23 | \r | |
24 | .code\r | |
25 | \r | |
26 | ;------------------------------------------------------------------------------\r | |
27 | ; VOID\r | |
28 | ; EFIAPI\r | |
29 | ; InternalX86EnablePaging64 (\r | |
30 | ; IN UINT16 Cs,\r | |
31 | ; IN UINT64 EntryPoint,\r | |
32 | ; IN UINT64 Context1, OPTIONAL\r | |
33 | ; IN UINT64 Context2, OPTIONAL\r | |
34 | ; IN UINT64 NewStack\r | |
35 | ; );\r | |
36 | ;------------------------------------------------------------------------------\r | |
37 | InternalX86EnablePaging64 PROC\r | |
38 | cli\r | |
39 | pop rax ; skip the return address\r | |
40 | call @Base\r | |
41 | @Base:\r | |
42 | add dword ptr [rsp], @F - @Base ; offset for far retf, seg is the 1st arg\r | |
43 | mov rax, cr4 ; mov eax, cr4\r | |
44 | or al, (1 SHL 5)\r | |
45 | mov cr4, rax ; enable PAE\r | |
46 | mov ecx, 0c0000080h\r | |
47 | rdmsr\r | |
48 | or ah, 1 ; set LME\r | |
49 | wrmsr\r | |
50 | mov rax, cr0 ; mov eax, cr0\r | |
51 | bts eax, 31\r | |
52 | mov cr0, rax ; enable paging\r | |
53 | retf\r | |
54 | @@: ; long mode starts here\r | |
55 | mov rbx, [esp]\r | |
56 | mov rcx, [esp + 8]\r | |
57 | mov rdx, [esp + 10h]\r | |
58 | mov rsp, [esp + 18h]\r | |
59 | add rsp, -20h\r | |
60 | call rbx\r | |
61 | hlt ; halt processor if EntryPoint() returned\r | |
62 | InternalX86EnablePaging64 ENDP\r | |
63 | \r | |
64 | END\r |