]>
Commit | Line | Data |
---|---|---|
f1baef62 | 1 | #------------------------------------------------------------------------------ |
2 | # | |
2faf4da5 | 3 | # Copyright (c) 2006 - 2008, Intel Corporation |
f1baef62 | 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.S | |
15 | # | |
16 | # Abstract: | |
17 | # | |
18 | # AsmEnablePaging64 function | |
19 | # | |
20 | # Notes: | |
21 | # | |
22 | #------------------------------------------------------------------------------ | |
23 | ||
24 | ||
25 | #------------------------------------------------------------------------------ | |
26 | # VOID | |
27 | # EFIAPI | |
28 | # InternalX86EnablePaging64 ( | |
2faf4da5 | 29 | # IN UINT16 Cs, |
30 | # IN UINT64 EntryPoint, | |
31 | # IN UINT64 Context1, OPTIONAL | |
32 | # IN UINT64 Context2, OPTIONAL | |
33 | # IN UINT64 NewStack | |
f1baef62 | 34 | # ); |
35 | #------------------------------------------------------------------------------ | |
85c25283 | 36 | .global ASM_PFX(InternalX86EnablePaging64) |
37 | ASM_PFX(InternalX86EnablePaging64): | |
f1baef62 | 38 | cli |
2faf4da5 | 39 | pop %rax # skip the return address |
f1baef62 | 40 | callq Base |
41 | Base: | |
2faf4da5 | 42 | addl $(L1-Base),(%rsp) # offset for ret, seg is the 1st arg |
f1baef62 | 43 | mov %cr4,%rax |
44 | or $0x20,%al | |
2faf4da5 | 45 | mov %rax,%cr4 # enable PAE |
f1baef62 | 46 | mov $0xc0000080,%ecx |
47 | rdmsr | |
2faf4da5 | 48 | or $0x1,%ah # set LME |
f1baef62 | 49 | wrmsr |
50 | mov %cr0,%rax | |
51 | bts $0x1f,%eax | |
2faf4da5 | 52 | mov %rax,%cr0 # enable paging |
f1baef62 | 53 | lret |
2faf4da5 | 54 | L1: # long mode starts here |
f1baef62 | 55 | addr32 mov (%esp),%rbx |
56 | addr32 mov 0x8(%esp),%rcx | |
57 | addr32 mov 0x10(%esp),%rdx | |
58 | addr32 mov 0x18(%esp),%rsp | |
59 | add $-0x20,%rsp | |
60 | callq *%rbx | |
2faf4da5 | 61 | jmp . # dead loop if EntryPoint() returned |