]>
Commit | Line | Data |
---|---|---|
f1baef62 | 1 | #------------------------------------------------------------------------------ |
2 | # | |
c2049caa | 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 | # DisablePaging64.S | |
15 | # | |
16 | # Abstract: | |
17 | # | |
18 | # AsmDisablePaging64 function | |
19 | # | |
20 | # Notes: | |
21 | # | |
22 | #------------------------------------------------------------------------------ | |
23 | ||
24 | ||
25 | ||
26 | #------------------------------------------------------------------------------ | |
27 | # VOID | |
28 | # EFIAPI | |
29 | # InternalX86DisablePaging64 ( | |
2faf4da5 | 30 | # IN UINT16 Cs, |
31 | # IN UINT64 EntryPoint, | |
32 | # IN UINT64 Context1, OPTIONAL | |
33 | # IN UINT32 Context2, OPTIONAL | |
34 | # IN UINT64 NewStack | |
f1baef62 | 35 | # ); |
36 | #------------------------------------------------------------------------------ | |
37 | ||
85c25283 | 38 | .global ASM_PFX(InternalX86DisablePaging64) |
39 | ASM_PFX(InternalX86DisablePaging64): | |
f1baef62 | 40 | cli |
2faf4da5 | 41 | shl $0x20,%rcx # rcx[32..47] <- Cs |
c2049caa | 42 | lea L1, %eax |
43 | mov %r8d, %esi \r | |
2faf4da5 | 44 | or %rax, %rcx # rcx[0..47] <- Cs:@F\r |
c2049caa | 45 | mov %r9d, %edi \r |
2faf4da5 | 46 | mov 0x28(%rsp), %eax # eax <- New Stack\r |
c2049caa | 47 | push %rcx\r |
2faf4da5 | 48 | ret # switch to compatibility mode\r |
f1baef62 | 49 | L1: |
2faf4da5 | 50 | mov %eax,%esp # set up new stack |
f1baef62 | 51 | mov %cr0,%rax |
52 | btr $0x1f,%eax | |
2faf4da5 | 53 | mov %rax,%cr0 # disable paging |
f1baef62 | 54 | mov $0xc0000080,%ecx |
55 | rdmsr | |
2faf4da5 | 56 | and $0xfe,%ah # clear LME |
f1baef62 | 57 | wrmsr |
58 | mov %cr4,%rax | |
2faf4da5 | 59 | and $0xdf,%al # clear PAE |
f1baef62 | 60 | mov %rax,%cr4 |
2faf4da5 | 61 | push %rdi # push Context2 |
62 | push %rsi # push Context1 | |
63 | callq *%rdx # transfer control to EntryPoint | |
64 | jmp . # no one should get here | |
f1baef62 | 65 |