2 // Include common header file for this module.
4 #include "CommonHeader.h"
6 ;------------------------------------------------------------------------------
8 ; Copyright (c) 2006, Intel Corporation
9 ; All rights reserved. This program and the accompanying materials
10 ; are licensed and made available under the terms and conditions of the BSD License
11 ; which accompanies this distribution. The full text of the license may be found at
12 ; http://opensource.org/licenses/bsd-license.php
14 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23 ; AsmEnablePaging64 function
27 ;------------------------------------------------------------------------------
33 ;------------------------------------------------------------------------------
36 ; InternalX86EnablePaging64 (
38 ; IN UINT64 EntryPoint,
39 ; IN UINT64 Context1, OPTIONAL
40 ; IN UINT64 Context2, OPTIONAL
43 ;------------------------------------------------------------------------------
44 InternalX86EnablePaging64 PROC
46 mov [esp], @F ; offset for far retf, seg is the 1st arg
49 mov cr4, eax ; enable PAE
56 mov cr0, eax ; enable paging
57 retf ; topmost 2 dwords hold the address
58 @@: ; long mode starts here
59 DB 67h, 48h ; 32-bit address size, 64-bit operand size
60 mov ebx, [esp] ; mov rbx, [esp]
62 mov ecx, [esp + 8] ; mov rcx, [esp + 8]
64 mov edx, [esp + 10h] ; mov rdx, [esp + 10h]
66 mov esp, [esp + 18h] ; mov rsp, [esp + 18h]
68 add esp, -20h ; add rsp, -20h
70 hlt ; no one should get here
71 InternalX86EnablePaging64 ENDP