+++ /dev/null
-;------------------------------------------------------------------------------\r
-;\r
-; Copyright (c) 2006, Intel Corporation\r
-; All rights reserved. This program and the accompanying materials\r
-; are licensed and made available under the terms and conditions of the BSD License\r
-; which accompanies this distribution. The full text of the license may be found at\r
-; http://opensource.org/licenses/bsd-license.php\r
-;\r
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-;\r
-; Module Name:\r
-;\r
-; DisablePaging64.Asm\r
-;\r
-; Abstract:\r
-;\r
-; AsmDisablePaging64 function\r
-;\r
-; Notes:\r
-;\r
-;------------------------------------------------------------------------------\r
-\r
- .code\r
-\r
-;------------------------------------------------------------------------------\r
-; VOID\r
-; EFIAPI\r
-; InternalX86DisablePaging64 (\r
-; IN UINT16 Cs,\r
-; IN UINT32 EntryPoint,\r
-; IN UINT32 Context1, OPTIONAL\r
-; IN UINT32 Context2, OPTIONAL\r
-; IN UINT32 NewStack\r
-; );\r
-;------------------------------------------------------------------------------\r
-InternalX86DisablePaging64 PROC\r
- cli\r
- shl rcx, 32 ; rcx[32..47] <- Cs\r
- lea eax, @F\r
- mov esi, r8d\r
- or rcx, rax ; rcx[0..47] <- Cs:@F\r
- mov edi, r9d\r
- mov eax, [rsp + 28h] ; eax <- New Stack\r
- push rcx\r
- retf ; switch to compatibility mode\r
-@@:\r
- mov esp, eax ; set up new stack\r
- mov rax, cr0\r
- btr eax, 31\r
- mov cr0, rax ; disable paging\r
- mov ecx, 0c0000080h\r
- rdmsr\r
- and ah, NOT 1 ; clear LME\r
- wrmsr\r
- mov rax, cr4\r
- and al, NOT (1 SHL 5) ; clear PAE\r
- mov cr4, rax\r
- push rdi ; push Context2\r
- push rsi ; push Context1\r
- call rdx ; transfer control to EntryPoint\r
- hlt ; no one should get here\r
-InternalX86DisablePaging64 ENDP\r
-\r
- END\r