]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/DisablePaging32.c
d3c77183ebbc62657c24193996b57509663ac4ec
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / DisablePaging32.c
1 /** @file
2 AsmDisablePaging32 function.
3
4 Copyright (c) 2006 - 2007, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 //
16 // Include common header file for this module.
17 //
18 #include "CommonHeader.h"
19
20 __declspec (naked)
21 VOID
22 EFIAPI
23 InternalX86DisablePaging32 (
24 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
25 IN VOID *Context1, OPTIONAL
26 IN VOID *Context2, OPTIONAL
27 IN VOID *NewStack
28 )
29 {
30 _asm {
31 push ebp
32 mov ebp, esp
33 mov ebx, EntryPoint
34 mov ecx, Context1
35 mov edx, Context2
36 pushfd
37 pop edi // save EFLAGS to edi
38 cli
39 mov eax, cr0
40 btr eax, 31
41 mov esp, NewStack
42 mov cr0, eax
43 push edi
44 popfd // restore EFLAGS from edi
45 push edx
46 push ecx
47 call ebx
48 jmp $ // EntryPoint() should not return
49 }
50 }
51