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 # AsmEnablePaging64 function
22 #------------------------------------------------------------------------------
25 #------------------------------------------------------------------------------
28 # InternalX86EnablePaging64 (
30 # IN UINT64 EntryPoint,
31 # IN UINT64 Context1, OPTIONAL
32 # IN UINT64 Context2, OPTIONAL
35 #------------------------------------------------------------------------------
36 .global ASM_PFX(InternalX86EnablePaging64)
37 ASM_PFX(InternalX86EnablePaging64):
39 pop %rax # skip the return address
42 addl $(L1-Base),(%rsp) # offset for ret, seg is the 1st arg
45 mov %rax,%cr4 # enable PAE
52 mov %rax,%cr0 # enable paging
54 L1: # long mode starts here
55 addr32 mov (%esp),%rbx
56 addr32 mov 0x8(%esp),%rcx
57 addr32 mov 0x10(%esp),%rdx
58 addr32 mov 0x18(%esp),%rsp
61 jmp . # dead loop if EntryPoint() returned