]>
Commit | Line | Data |
---|---|---|
3eb9473e | 1 | ; Copyright (c) 2004, Intel Corporation \r |
2 | ; All rights reserved. This program and the accompanying materials \r | |
3 | ; are licensed and made available under the terms and conditions of the BSD License \r | |
4 | ; which accompanies this distribution. The full text of the license may be found at \r | |
5 | ; http://opensource.org/licenses/bsd-license.php \r | |
6 | ; \r | |
7 | ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
8 | ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
9 | ;\r | |
10 | ; Module Name:\r | |
11 | ;\r | |
12 | ; DisablePaging64.Asm\r | |
13 | ;\r | |
14 | ; Abstract:\r | |
15 | ;\r | |
16 | ; AsmDisablePaging64 function\r | |
17 | ;\r | |
18 | ; Notes:\r | |
19 | ;\r | |
20 | ;------------------------------------------------------------------------------\r | |
21 | \r | |
22 | .code\r | |
23 | \r | |
24 | ;------------------------------------------------------------------------------\r | |
25 | ; VOID\r | |
26 | ; EFIAPI\r | |
27 | ; InternalX86DisablePaging64 (\r | |
28 | ; IN UINT16 Cs,\r | |
29 | ; IN UINT32 EntryPoint,\r | |
30 | ; IN UINT32 Context1, OPTIONAL\r | |
31 | ; IN UINT32 Context2, OPTIONAL\r | |
32 | ; IN UINT32 NewStack\r | |
33 | ; );\r | |
34 | ;------------------------------------------------------------------------------\r | |
35 | InternalX86DisablePaging64 PROC\r | |
36 | cli\r | |
37 | shl rcx, 32 ; rcx[32..47] <- Cs\r | |
38 | lea eax, @F\r | |
39 | mov esi, r8d\r | |
40 | or rcx, rax ; rcx[0..47] <- Cs:@F\r | |
41 | mov edi, r9d\r | |
42 | mov eax, [rsp + 28h] ; eax <- New Stack\r | |
43 | push rcx\r | |
44 | retf ; switch to compatibility mode\r | |
45 | @@:\r | |
46 | mov esp, eax ; set up new stack\r | |
47 | mov rax, cr0\r | |
48 | btr eax, 31\r | |
49 | mov cr0, rax ; disable paging\r | |
50 | mov ecx, 0c0000080h\r | |
51 | rdmsr\r | |
52 | and ah, NOT 1 ; clear LME\r | |
53 | wrmsr\r | |
54 | mov rax, cr4\r | |
55 | and al, NOT (1 SHL 5) ; clear PAE\r | |
56 | mov cr4, rax\r | |
57 | push rdi ; push Context2\r | |
58 | push rsi ; push Context1\r | |
59 | call rdx ; transfer control to EntryPoint\r | |
60 | hlt ; no one should get here\r | |
61 | InternalX86DisablePaging64 ENDP\r | |
62 | \r | |
63 | END\r |