Vishal Bhoj | 82c8071 | 2015-12-15 21:13:33 +0530 | [diff] [blame^] | 1 | /** @file
|
| 2 | IA-32/x64 AsmDisablePaging64()
|
| 3 |
|
| 4 | Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
| 5 | 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 |
|
| 17 |
|
| 18 | #include "BaseLibInternals.h"
|
| 19 |
|
| 20 | /**
|
| 21 | Disables the 64-bit paging mode on the CPU.
|
| 22 |
|
| 23 | Disables the 64-bit paging mode on the CPU and returns to 32-bit protected
|
| 24 | mode. This function assumes the current execution mode is 64-paging mode.
|
| 25 | This function is only available on x64. After the 64-bit paging mode is
|
| 26 | disabled, control is transferred to the function specified by EntryPoint
|
| 27 | using the new stack specified by NewStack and passing in the parameters
|
| 28 | specified by Context1 and Context2. Context1 and Context2 are optional and
|
| 29 | may be 0. The function EntryPoint must never return.
|
| 30 |
|
| 31 | If the current execution mode is not 64-bit paged mode, then ASSERT().
|
| 32 | If EntryPoint is 0, then ASSERT().
|
| 33 | If NewStack is 0, then ASSERT().
|
| 34 |
|
| 35 | @param Cs The 16-bit selector to load in the CS before EntryPoint
|
| 36 | is called. The descriptor in the GDT that this selector
|
| 37 | references must be setup for 32-bit protected mode.
|
| 38 | @param EntryPoint The 64-bit virtual address of the function to call with
|
| 39 | the new stack after paging is disabled.
|
| 40 | @param Context1 The 64-bit virtual address of the context to pass into
|
| 41 | the EntryPoint function as the first parameter after
|
| 42 | paging is disabled.
|
| 43 | @param Context2 The 64-bit virtual address of the context to pass into
|
| 44 | the EntryPoint function as the second parameter after
|
| 45 | paging is disabled.
|
| 46 | @param NewStack The 64-bit virtual address of the new stack to use for
|
| 47 | the EntryPoint function after paging is disabled.
|
| 48 |
|
| 49 | **/
|
| 50 | VOID
|
| 51 | EFIAPI
|
| 52 | AsmDisablePaging64 (
|
| 53 | IN UINT16 Cs,
|
| 54 | IN UINT32 EntryPoint,
|
| 55 | IN UINT32 Context1, OPTIONAL
|
| 56 | IN UINT32 Context2, OPTIONAL
|
| 57 | IN UINT32 NewStack
|
| 58 | )
|
| 59 | {
|
| 60 | ASSERT (EntryPoint != 0);
|
| 61 | ASSERT (NewStack != 0);
|
| 62 | InternalX86DisablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);
|
| 63 | }
|