]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/DisablePaging32.c
Optimize the size of the Base Library for the MSFT 32-bit tool chains by taking advan...
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / DisablePaging32.c
1 /** @file
2 AsmDisablePaging32 function.
3
4 Copyright (c) 2006, 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 #if _MSC_EXTENSIONS
16
17 __declspec (naked)
18 VOID
19 EFIAPI
20 InternalX86DisablePaging32 (
21 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
22 IN VOID *Context1, OPTIONAL
23 IN VOID *Context2, OPTIONAL
24 IN VOID *NewStack
25 )
26 {
27 _asm {
28 push ebp
29 mov ebp, esp
30 mov ebx, EntryPoint
31 mov ecx, Context1
32 mov edx, Context2
33 pushfd
34 pop edi // save EFLAGS to edi
35 cli
36 mov eax, cr0
37 btr eax, 31
38 mov esp, NewStack
39 mov cr0, eax
40 push edi
41 popfd // restore EFLAGS from edi
42 push edx
43 push ecx
44 call ebx
45 jmp $ // EntryPoint() should not return
46 }
47 }
48
49 #endif