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 InternalX86EnablePaging64 PROC
31 mov ebx, [esp + 4] ; save CS
32 mov eax, OFFSET cs_address
33 mov word ptr [eax], bx ; Update CS selector for far jump
37 mov cr4, eax ; enable PAE
44 mov cr0, eax ; enable paging
50 ; This is the next instruction after enabling paging. Jump to long mode
53 db 0eah ; Far Jump Offset:Selector to reload CS
54 dd OFFSET in_long_mode ; Offset is ensuing instruction boundary
56 dw 0h ; CS selector will be updated at runtime
58 in_long_mode: ; now in long mode
60 mov ebx, [esp + 8] ; mov rbx, [esp]
62 mov ecx, [esp + 10h] ; mov rcx, [esp + 8]
64 mov edx, [esp + 18h] ; mov rdx, [esp + 10h]
66 mov esp, [esp + 20h] ; mov rsp, [esp + 18h]
70 InternalX86EnablePaging64 ENDP