]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/EnablePaging64.S
44b7e16558fd8cafdf08fdc63a532cc182a6b8c8
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / EnablePaging64.S
1 //
2 // Include common header file for this module.
3 //
4 #include "CommonHeader.h"
5
6 #------------------------------------------------------------------------------
7 #
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
13 #
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.
16 #
17 # Module Name:
18 #
19 # EnablePaging64.Asm
20 #
21 # Abstract:
22 #
23 # InternalX86EnablePaging64 function
24 #
25 # Notes:
26 #
27 #------------------------------------------------------------------------------
28
29 .globl ASM_PFX(InternalX86EnablePaging64)
30
31 #------------------------------------------------------------------------------
32 # VOID
33 # EFIAPI
34 # InternalX86EnablePaging64 (
35 # IN UINT16 CodeSelector,
36 # IN UINT64 EntryPoint,
37 # IN UINT64 Context1, OPTIONAL
38 # IN UINT64 Context2, OPTIONAL
39 # IN UINT64 NewStack
40 # );
41 #------------------------------------------------------------------------------
42 ASM_PFX(InternalX86EnablePaging64):
43 cli
44 movl $LongStart, (%esp)
45 movl %cr4, %eax
46 orb $0x20, %al
47 movl %eax, %cr4 # enable PAE
48 movl $0xc0000080, %ecx
49 rdmsr
50 orb $1, %ah # set LME
51 wrmsr
52 movl %cr0, %eax
53 btsl $31, %eax
54 movl %eax, %cr0 # enable paging
55 lret
56 LongStart: # long mode starts here
57 .byte 0x67, 0x48
58 movl (%esp), %ebx # mov rbx, [esp]
59 .byte 0x67, 0x48
60 movl 8(%esp), %ecx # mov rcx, [esp + 8]
61 .byte 0x67, 0x48
62 movl 0x10(%esp), %edx # mov rdx, [esp + 10h]
63 .byte 0x67, 0x48
64 movl 0x18(%esp), %esp # mov rsp, [esp + 18h]
65 .byte 0x48
66 addl $0x-20, %esp # add rsp, -20h
67 call *%ebx # call rbx
68 jmp .