]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseLib/Ia32/EnablePaging64.S
Add some definitions in Framework FV 0.9 spec but not in PI 1.0.
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / EnablePaging64.S
CommitLineData
e1f414b6 1//\r
2// Include common header file for this module.\r
3//\r
4#include "CommonHeader.h"\r
5\r
6#------------------------------------------------------------------------------\r
7#\r
8# Copyright (c) 2006, Intel Corporation\r
9# All rights reserved. This program and the accompanying materials\r
10# are licensed and made available under the terms and conditions of the BSD License\r
11# which accompanies this distribution. The full text of the license may be found at\r
12# http://opensource.org/licenses/bsd-license.php\r
13#\r
14# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
16#\r
17# Module Name:\r
18#\r
19# EnablePaging64.Asm\r
20#\r
21# Abstract:\r
22#\r
23# InternalX86EnablePaging64 function\r
24#\r
25# Notes:\r
26#\r
27#------------------------------------------------------------------------------\r
28\r
29.globl ASM_PFX(InternalX86EnablePaging64)\r
30\r
31#------------------------------------------------------------------------------\r
32# VOID\r
33# EFIAPI\r
34# InternalX86EnablePaging64 (\r
35# IN UINT16 CodeSelector,\r
36# IN UINT64 EntryPoint,\r
37# IN UINT64 Context1, OPTIONAL\r
38# IN UINT64 Context2, OPTIONAL\r
39# IN UINT64 NewStack\r
40# );\r
41#------------------------------------------------------------------------------\r
42ASM_PFX(InternalX86EnablePaging64):\r
43 cli\r
44 movl $LongStart, (%esp)\r
45 movl %cr4, %eax\r
46 orb $0x20, %al\r
47 movl %eax, %cr4 # enable PAE\r
48 movl $0xc0000080, %ecx\r
49 rdmsr\r
50 orb $1, %ah # set LME\r
51 wrmsr\r
52 movl %cr0, %eax\r
53 btsl $31, %eax\r
54 movl %eax, %cr0 # enable paging\r
55 lret\r
56LongStart: # long mode starts here\r
57 .byte 0x67, 0x48\r
58 movl (%esp), %ebx # mov rbx, [esp]\r
59 .byte 0x67, 0x48\r
60 movl 8(%esp), %ecx # mov rcx, [esp + 8]\r
61 .byte 0x67, 0x48\r
62 movl 0x10(%esp), %edx # mov rdx, [esp + 10h]\r
63 .byte 0x67, 0x48\r
64 movl 0x18(%esp), %esp # mov rsp, [esp + 18h]\r
65 .byte 0x48\r
66 addl $0x-20, %esp # add rsp, -20h\r
67 call *%ebx # call rbx\r
68 jmp .\r