]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/EnablePaging64.asm
1. Add Assert in SetJump.S
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / EnablePaging64.asm
1 ;------------------------------------------------------------------------------
2 ;
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
8 ;
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.
11 ;
12 ; Module Name:
13 ;
14 ; EnablePaging64.Asm
15 ;
16 ; Abstract:
17 ;
18 ; AsmEnablePaging64 function
19 ;
20 ; Notes:
21 ;
22 ;------------------------------------------------------------------------------
23
24 .686p
25 .model flat,C
26 .code
27
28 InternalX86EnablePaging64 PROC
29 cli
30 mov [esp], @F ; offset for far retf
31 mov eax, cr4
32 or al, (1 SHL 5)
33 mov cr4, eax ; enable PAE
34 mov ecx, 0c0000080h
35 rdmsr
36 or ah, 1 ; set LME
37 wrmsr
38 mov eax, cr0
39 bts eax, 31
40 mov cr0, eax ; enable paging
41 retf
42 @@: ; long mode starts here
43 DB 67h, 48h
44 mov ebx, [esp] ; mov rbx, [esp]
45 DB 67h, 48h
46 mov ecx, [esp + 8] ; mov rcx, [esp + 8]
47 DB 67h, 48h
48 mov edx, [esp + 10h] ; mov rdx, [esp + 10h]
49 DB 67h, 48h
50 mov esp, [esp + 18h] ; mov rsp, [esp + 18h]
51 DB 48h
52 add esp, -20h ; add rsp, -20h
53 call ebx ; call rbx
54 jmp $
55 InternalX86EnablePaging64 ENDP
56
57 END