1 ;------------------------------------------------------------------------------
3 ; Copyright (c) 2006, 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 ;------------------------------------------------------------------------------
28 ;------------------------------------------------------------------------------
31 ; InternalX86EnablePaging64 (
33 ; IN UINT64 EntryPoint,
34 ; IN UINT64 Context1, OPTIONAL
35 ; IN UINT64 Context2, OPTIONAL
38 ;------------------------------------------------------------------------------
39 InternalX86EnablePaging64 PROC
41 mov [esp], @F ; offset for far retf, seg is the 1st arg
44 mov cr4, eax ; enable PAE
51 mov cr0, eax ; enable paging
52 retf ; topmost 2 dwords hold the address
53 @@: ; long mode starts here
54 DB 67h, 48h ; 32-bit address size, 64-bit operand size
55 mov ebx, [esp] ; mov rbx, [esp]
57 mov ecx, [esp + 8] ; mov rcx, [esp + 8]
59 mov edx, [esp + 10h] ; mov rdx, [esp + 10h]
61 mov esp, [esp + 18h] ; mov rsp, [esp + 18h]
63 add esp, -20h ; add rsp, -20h
65 hlt ; no one should get here
66 InternalX86EnablePaging64 ENDP