1 #------------------------------------------------------------------------------
3 # Copyright (c) 2006 - 2008, Intel Corporation
4 # All rights reserved. This program and the accompanying materials
5 # are licensed and made available under the terms and conditions of the BSD License
6 # which accompanies this distribution. The full text of the license may be found at
7 # http://opensource.org/licenses/bsd-license.php
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 # AsmDisablePaging64 function
22 #------------------------------------------------------------------------------
26 #------------------------------------------------------------------------------
29 # InternalX86DisablePaging64 (
31 # IN UINT64 EntryPoint,
32 # IN UINT64 Context1, OPTIONAL
33 # IN UINT32 Context2, OPTIONAL
36 #------------------------------------------------------------------------------
38 .global ASM_PFX(InternalX86DisablePaging64)
39 ASM_PFX(InternalX86DisablePaging64):
41 shl $0x20,%rcx # rcx[32..47] <- Cs
44 or %rax, %rcx # rcx[0..47] <- Cs:@F
46 mov 0x28(%rsp), %eax # eax <- New Stack
48 ret # switch to compatibility mode
50 mov %eax,%esp # set up new stack
53 mov %rax,%cr0 # disable paging
55 mov %rdx,%rbx # save EntryPoint to rbx, for rdmsr will overwrite rdx
58 and $0xfe,%ah # clear LME
61 and $0xdf,%al # clear PAE
63 push %rdi # push Context2
64 push %rsi # push Context1
65 callq *%rbx # transfer control to EntryPoint
66 jmp . # no one should get here