Update the Guid Value of Ext SCSI Pass Thru Protocol
[mirror_edk2.git] / MdePkg / Library / BaseLib / SwitchStack.c
1 /** @file
2 Switch Stack functions.
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 Module Name: SwitchStack.c
14
15 **/
16
17 #include <BaseLibInternals.h>
18
19 /**
20 Transfers control to a function starting with a new stack.
21
22 Transfers control to the function specified by EntryPoint using the
23 new stack specified by NewStack and passing in the parameters specified
24 by Context1 and Context2. Context1 and Context2 are optional and may
25 be NULL. The function EntryPoint must never return. This function
26 supports a variable number of arguments following the NewStack parameter.
27 These additional arguments are ignored on IA-32, x64, and EBC.
28 IPF CPUs expect one additional parameter of type VOID * that specifies
29 the new backing store pointer.
30
31 If EntryPoint is NULL, then ASSERT().
32 If NewStack is NULL, then ASSERT().
33
34 @param EntryPoint A pointer to function to call with the new stack.
35 @param Context1 A pointer to the context to pass into the EntryPoint
36 function.
37 @param Context2 A pointer to the context to pass into the EntryPoint
38 function.
39 @param NewStack A pointer to the new stack to use for the EntryPoint
40 function.
41
42 **/
43 VOID
44 EFIAPI
45 SwitchStack (
46 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
47 IN VOID *Context1, OPTIONAL
48 IN VOID *Context2, OPTIONAL
49 IN VOID *NewStack,
50 ...
51 )
52 {
53 VA_LIST Marker;
54
55 ASSERT (EntryPoint != NULL);
56 ASSERT (NewStack != NULL);
57
58 VA_START (Marker, NewStack);
59
60 InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker);
61
62 //
63 // InternalSwitchStack () will never return
64 //
65 ASSERT (FALSE);
66 }