Created as wrapper for SwitchStack() to add assert()
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ipf / SwitchStack.c
1 /** @file
2 Switch Stack functions.
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 Module Name: SwitchStack.c
14
15 **/
16
17 /**
18 Transfers control to a function starting with a new stack.
19
20 Transfers control to the function specified by EntryPoint using the new stack
21 specified by NewStack and passing in the parameters specified by Context1 and
22 Context2. Context1 and Context2 are optional and may be NULL. The function
23 EntryPoint must never return.
24
25 If EntryPoint is NULL, then ASSERT().
26 If NewStack is NULL, then ASSERT().
27
28 @param EntryPoint A pointer to function to call with the new stack.
29 @param Context1 A pointer to the context to pass into the EntryPoint
30 function.
31 @param Context2 A pointer to the context to pass into the EntryPoint
32 function.
33 @param NewStack A pointer to the new stack to use for the EntryPoint
34 function.
35
36 **/
37 VOID
38 EFIAPI
39 SwitchStack (
40 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
41 IN VOID *Context1,
42 IN VOID *Context2,
43 IN VOID *NewStack
44 )
45 {
46 ASSERT (EntryPoint != NULL && NewStack != NULL);
47
48 _SwitchStack (EntryPoint, Context1, Context2, NewStack);
49 }